<!doctype html>
<html lang="ru" data-bs-theme="dark">

<head>
    <!-- 2024-05-08 18:41:54 -->
        <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>git reset</title>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css" integrity="sha512-jnSuA4Ss2PkkikSOLtYs8BlYIeeIK1h99ty4YfvRPAlzr377vr3CXDb7sb7eEEBYjDtcYj+AjBH3FLv5uSJuXg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" integrity="sha512-dPXYcDub/aeb08c63jRq/k6GaKccl256JQy/AnOq7CAnEZ9FzSL9wSbcZkMp4R26vBsMLFYH4kQ67/bbV8XaCQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" integrity="sha512-rO+olRTkcf304DQBxSWxln8JXCzTHlKnIdnMUwYvQa9/Jd4cQaNkItIUj6Z4nvW1dqK0SKXLbn9h4KwZTNtAyw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/7.1.0/css/flag-icons.min.css" integrity="sha512-bZBu2H0+FGFz/stDN/L0k8J0G8qVsAL0ht1qg5kTwtAheiXwiRKyCq1frwfbSFSJN3jooR5kauE0YjtPzhZtJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link href="../../../runebook.css" rel="stylesheet" type="text/css">
    <meta name="x-github" content="https://github.com/runebookdev/runebook">
            <meta name="x-i18n-doc" content="git">
        <script>
        function i18n(element) {
            // NOP
        }
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/3.0.5/js.cookie.js" integrity="sha512-F/dia2jKME12jwqiYDayeD+Rr/8jTWUD2wfbuJB0bzSwenSEnXsn4qQ/wVyXUCix5bmCAj8xJdtFr2OqUtjLAw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js" integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/7.8.1/rxjs.umd.min.js" integrity="sha512-D9LDs8YUUVa4V9Gl4Zb+xqRAc7RCzooR3+zzebgK2RMu/KU+dh90pbjEEMzPiSyRSGbSp9j1pZnrO4joGa5WEg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha512-mhbv5DqBMgrWL+32MmsDOt/OAvqr/cHimk6B8y/bx/xS88MVkYGPiVv2ixKVrkywF2qHplNRUvFsAHUdxZ3Krg==" crossorigin="anonymous"></script>
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6424571640879890" crossorigin="anonymous"></script>    <script async src="https://www.googletagmanager.com/gtag/js?id=G-3G5BZ1QEDP"></script>
<script>
    window.dataLayer = window.dataLayer || [];

    function gtag() {
        dataLayer.push(arguments);
    }

    gtag('js', new Date());
    gtag('config', 'G-3G5BZ1QEDP');
</script>    <script>
(function(c, l, a, r, i, t, y) {
    c[a] = c[a] || function() {
        (c[a].q = c[a].q || []).push(arguments)
    };
    t = l.createElement(r);
    t.async = 1;
    t.src = "https://www.clarity.ms/tag/" + i + "?ref=bwt";
    y = l.getElementsByTagName(r)[0];
    y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "jto2hd94r9");
</script>    <script src="../../../theme.js"></script>
</head>

<body>
    <header class="bg-black">
        <div class="container">
            <div class="row">
                <div class="col">
                    <nav class="navbar navbar-expand-lg navbar-dark">
                        <a class="navbar-brand fw-bold" href="https://runebook.dev/ru">
                            <img alt="Runebook.dev" class="d-inline-block align-top mr-1" src="../../../assets/runebook_logo.webp" width="24" height="24">
                            Runebook.dev
                        </a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                            <span class="navbar-toggler-icon"></span>
                        </button>
                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                                <li class="nav-item">
                                    <a class="nav-link" href="https://runebook.dev/ru#docs">Documentation</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://runebook.dev/contributors">Contributors</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://github.com/runebookdev/runebook/issues">GitHub</a>
                                </li>
                            </ul>
                                                                                                <button class="btn btn-success ms-2" id="showPopupButton">
                                        <i class="bi bi-translate"></i>
                                        Show English
                                    </button>
                                                                                        <div class="form-check form-switch ms-3">
                                <label class="text-light">
                                    <input class="form-check-input" type="checkbox" role="switch" id="theme-switch" checked>
                                    <i class="bi bi-moon-stars-fill"></i>
                                </label>
                            </div>
                        </div>
                    </nav>
                </div>
            </div>
        </div>
    </header>

    <!--sse-->
    <div class="container">
    <div class="row">
        <div class="col">
            <nav aria-label="breadcrumb" class="mt-2">
                <ol class="breadcrumb mb-1">
                    <li class="breadcrumb-item">
                        <a href="https://runebook.dev/ru#docs">
                            <span class="fi fi-ru"></span>                            Русский                        </a>
                    </li>
                    <li class="breadcrumb-item">
                        <a href="-index-.html">
                            Git                            2.43                        </a>
                    </li>
                                            <li class="breadcrumb-item">
                            <a href="-index-.html#Basic_Snapshotting">
                                Basic Snapshotting                            </a>
                        </li>
                                    </ol>
            </nav>
        </div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-9">
            <main>
                <article>

                    
                    <h1 class="text-body-emphasis" ><span data-i18n="c1d55f98842009bc1aa6a5e9d518f82c07b8d98db2fd69964d71e854efe05d66/5f" data-source="git-reset" onmousemove="i18n(this)">git-reset</span></h1> <h2 class="text-body-emphasis"  id="_name"><span data-i18n="dcd1d5223f73b3a965c07e3ff5dbee3eedcfedb806686a05b9b3868a2c3d6d50/3a" data-source="Name" onmousemove="i18n(this)">Name</span></h2> <div> <p><span data-i18n="a4dee73436b09138c7921af4f792d30b3271bfb6deb3af83f45cc7ab3019554d/9f" data-source="git-reset - Reset current HEAD to the specified state" onmousemove="i18n(this)">git-reset &mdash; &Scy;&bcy;&rcy;&ocy;&scy;&icy;&tcy;&softcy; &tcy;&iecy;&kcy;&ucy;&shchcy;&icy;&jcy; HEAD &vcy; &ucy;&kcy;&acy;&zcy;&acy;&ncy;&ncy;&ocy;&iecy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy;</span></p> </div> <h2 class="text-body-emphasis"  id="_synopsis"><span data-i18n="8eb3755381519d7f0479d75446e56e20084834c0460d7ec94926932372ea6c47/0d" data-source="Synopsis" onmousemove="i18n(this)">Synopsis</span></h2> <div> <div> <pre class="hljs language-xml">git reset [-q] [<span class="hljs-tag">&lt;<span class="hljs-name">tree-ish</span>&gt;</span>] [--] <span class="hljs-tag">&lt;<span class="hljs-name">pathspec</span>&gt;</span>&hellip;&ZeroWidthSpace;
git reset [-q] [--pathspec-from-file=<span class="hljs-tag">&lt;<span class="hljs-name">file</span>&gt;</span> [--pathspec-file-nul]] [<span class="hljs-tag">&lt;<span class="hljs-name">tree-ish</span>&gt;</span>]
git reset (--patch | -p) [<span class="hljs-tag">&lt;<span class="hljs-name">tree-ish</span>&gt;</span>] [--] [<span class="hljs-tag">&lt;<span class="hljs-name">pathspec</span>&gt;</span>&hellip;&ZeroWidthSpace;]
git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<span class="hljs-tag">&lt;<span class="hljs-name">commit</span>&gt;</span>]</pre> </div> </div> <h2 class="text-body-emphasis"  id="_description"><span data-i18n="526e0087cc3f254d9f86f6c7d8e23d954c4dfda2b312efc29194ae8a860106ba/d3" data-source="Description" onmousemove="i18n(this)">Description</span></h2> <div> <p><span data-i18n="9c7f5360e74be1e7a9aa40abd416e376f1d1e49c362ce2c9f44bd65aedeaab7c/11" data-source="In the first three forms, copy entries from &lt;code&gt;&amp;lt;tree-ish&amp;gt;&lt;/code&gt; to the index. In the last form, set the current branch head (&lt;code&gt;HEAD&lt;/code&gt;) to &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt;, optionally modifying index and working tree to match. The &lt;code&gt;&amp;lt;tree-ish&amp;gt;&lt;/code&gt;/&lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; defaults to &lt;code&gt;HEAD&lt;/code&gt; in all forms." onmousemove="i18n(this)">&Vcy; &pcy;&iecy;&rcy;&vcy;&ycy;&khcy; &tcy;&rcy;&iecy;&khcy; &fcy;&ocy;&rcy;&mcy;&acy;&khcy; &scy;&kcy;&ocy;&pcy;&icy;&rcy;&ucy;&jcy;&tcy;&iecy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy;&zcy;  <code>&lt;tree-ish&gt;</code>  &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;. &Vcy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&iecy;&jcy; &fcy;&ocy;&rcy;&mcy;&iecy; &ucy;&scy;&tcy;&acy;&ncy;&ocy;&vcy;&icy;&tcy;&iecy; &tcy;&iecy;&kcy;&ucy;&shchcy;&icy;&jcy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&ocy;&kcy; &vcy;&iecy;&tcy;&kcy;&icy; (  <code>HEAD</code>  ) &ncy;&acy;  <code>&lt;commit&gt;</code>  , &pcy;&rcy;&icy; &ncy;&iecy;&ocy;&bcy;&khcy;&ocy;&dcy;&icy;&mcy;&ocy;&scy;&tcy;&icy; &icy;&zcy;&mcy;&iecy;&ncy;&icy;&vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &dcy;&lcy;&yacy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&icy;&yacy;. &Pcy;&ocy; &ucy;&mcy;&ocy;&lcy;&chcy;&acy;&ncy;&icy;&yucy;  <code>&lt;tree-ish&gt;</code> / <code>&lt;commit&gt;</code>  &icy;&mcy;&iecy;&iecy;&tcy; &zcy;&ncy;&acy;&chcy;&iecy;&ncy;&icy;&iecy;  <code>HEAD</code>  &vcy;&ocy; &vcy;&scy;&iecy;&khcy; &fcy;&ocy;&rcy;&mcy;&acy;&khcy;.</span></p> <div> <dl> <dt id="Documentation/git-reset.txt-emgitresetem-qlttree-ishgt--ltpathspecgt82308203"> <span data-i18n="bb5c6685d3e2ff58bc871c95ce08bda3b096b604990e048520f1ac6f85048cce/b9" data-source="&lt;em&gt;git reset&lt;/em&gt; [-q] [&amp;lt;tree-ish&amp;gt;] [--] &amp;lt;pathspec&amp;gt;&amp;hellip;" onmousemove="i18n(this)">git  &scy;&bcy;&rcy;&ocy;&scy; [-q] [&lt;&dcy;&iecy;&rcy;&iecy;&vcy;&ocy;&gt;] [--] &lt;&pcy;&ucy;&tcy;&softcy;&gt;&hellip;</span></dt> <dt id="Documentation/git-reset.txt-emgitresetem-q--pathspec-from-fileltfilegt--pathspec-file-nullttree-ishgt"> <span data-i18n="9b1af5ae06479f4d6d2f02d417ab002e6133060722096dda197e418ec2446285/27" data-source="&lt;em&gt;git reset&lt;/em&gt; [-q] [--pathspec-from-file=&amp;lt;file&amp;gt; [--pathspec-file-nul]] [&amp;lt;tree-ish&amp;gt;]" onmousemove="i18n(this)">git  &scy;&bcy;&rcy;&ocy;&scy; [-q] [--pathspec-from-file=&lt;file&gt; [--pathspec-file-nul]] [&lt;tree-ish&gt;]</span></dt> <dd> <p><span data-i18n="65ab7a6e28933dba3bd9c541c165a9f3599875cb3dcb83b0bd7892b3241b8bbe/52" data-source="These forms reset the index entries for all paths that match the &lt;code&gt;&amp;lt;pathspec&amp;gt;&lt;/code&gt; to their state at &lt;code&gt;&amp;lt;tree-ish&amp;gt;&lt;/code&gt;. (It does not affect the working tree or the current branch.)" onmousemove="i18n(this)">&Ecy;&tcy;&icy; &fcy;&ocy;&rcy;&mcy;&ycy; &scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&yucy;&tcy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy; &dcy;&lcy;&yacy; &vcy;&scy;&iecy;&khcy; &pcy;&ucy;&tcy;&iecy;&jcy;, &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&ucy;&yucy;&shchcy;&icy;&khcy;  <code>&lt;pathspec&gt;</code> , &dcy;&ocy; &icy;&khcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&yacy; &vcy;  <code>&lt;tree-ish&gt;</code> . (&Ecy;&tcy;&ocy; &ncy;&iecy; &vcy;&lcy;&icy;&yacy;&iecy;&tcy; &ncy;&acy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &icy;&lcy;&icy; &tcy;&iecy;&kcy;&ucy;&shchcy;&ucy;&yucy; &vcy;&iecy;&tcy;&vcy;&softcy;.)</span></p> <p><span data-i18n="908e76455f7d269674f9e64cfd100346142be79451b090d0421da5505a30cc4a/90" data-source="This means that &lt;code&gt;git reset &amp;lt;pathspec&amp;gt;&lt;/code&gt; is the opposite of &lt;code&gt;git add
&amp;lt;pathspec&amp;gt;&lt;/code&gt;. This command is equivalent to &lt;code&gt;git restore [--source=&amp;lt;tree-ish&amp;gt;] --staged &amp;lt;pathspec&amp;gt;...&lt;/code&gt;." onmousemove="i18n(this)">&Ecy;&tcy;&ocy; &ocy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy;  <code>git reset &lt;pathspec&gt;</code>  &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &pcy;&rcy;&ocy;&tcy;&icy;&vcy;&ocy;&pcy;&ocy;&lcy;&ocy;&zhcy;&ncy;&ocy;&scy;&tcy;&softcy;&yucy;  <code>git add
&lt;pathspec&gt;</code> . &Ecy;&tcy;&acy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;&acy; &ecy;&kcy;&vcy;&icy;&vcy;&acy;&lcy;&iecy;&ncy;&tcy;&ncy;&acy;  <code>git restore [--source=&lt;tree-ish&gt;] --staged &lt;pathspec&gt;...</code> .</span></p> <p><span data-i18n="5e180c69f0be40dd48d4a4214491009366f1f19e9ee9c96ae2b95c6614025e0f/77" data-source="After running &lt;code&gt;git reset &amp;lt;pathspec&amp;gt;&lt;/code&gt; to update the index entry, you can use &lt;a href=&quot;git-restore&quot;&gt;git-restore[1]&lt;/a&gt; to check the contents out of the index to the working tree. Alternatively, using &lt;a href=&quot;git-restore&quot;&gt;git-restore[1]&lt;/a&gt; and specifying a commit with &lt;code&gt;--source&lt;/code&gt;, you can copy the contents of a path out of a commit to the index and to the working tree in one go." onmousemove="i18n(this)">&Pcy;&ocy;&scy;&lcy;&iecy; &zcy;&acy;&pcy;&ucy;&scy;&kcy;&acy;  <code>git reset &lt;pathspec&gt;</code>  &dcy;&lcy;&yacy; &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy; &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy;  <a href="git-restore.html">git-restore[1]</a>  &dcy;&lcy;&yacy; &pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&kcy;&icy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&gcy;&ocy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;. &Acy;&lcy;&softcy;&tcy;&iecy;&rcy;&ncy;&acy;&tcy;&icy;&vcy;&ncy;&ocy;, &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yacy;  <a href="git-restore.html">git-restore[1]</a>  &icy; &ucy;&kcy;&acy;&zcy;&acy;&vcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy;  <code>--source</code>  , &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &scy;&kcy;&ocy;&pcy;&icy;&rcy;&ocy;&vcy;&acy;&tcy;&softcy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&iecy; &pcy;&ucy;&tcy;&icy; &icy;&zcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &icy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &zcy;&acy; &ocy;&dcy;&icy;&ncy; &rcy;&acy;&zcy;.</span></p> </dd> <dt id="Documentation/git-reset.txt-emgitresetem--patch-plttree-ishgt--ltpathspecgt82308203"> <span data-i18n="3a0a0f9d46e74b7876b091009c9a0e986fcb06717508026c1d923e764ff0512b/25" data-source="&lt;em&gt;git reset&lt;/em&gt; (--patch | -p) [&amp;lt;tree-ish&amp;gt;] [--] [&amp;lt;pathspec&amp;gt;&amp;hellip;&amp;ZeroWidthSpace;]" onmousemove="i18n(this)">git  &scy;&bcy;&rcy;&ocy;&scy; (--patch | -p) [&lt;&dcy;&iecy;&rcy;&iecy;&vcy;&ocy;&gt;] [--] [&lt;&pcy;&ucy;&tcy;&softcy;&gt;&hellip;&ZeroWidthSpace;]</span></dt> <dd> <p><span data-i18n="5fdf52e9297dfb6fa3f4d88da3a64042c27765fd32322f49f1c5438d5d2110af/24" data-source="Interactively select hunks in the difference between the index and &lt;code&gt;&amp;lt;tree-ish&amp;gt;&lt;/code&gt; (defaults to &lt;code&gt;HEAD&lt;/code&gt;). The chosen hunks are applied in reverse to the index." onmousemove="i18n(this)">&Vcy; &icy;&ncy;&tcy;&iecy;&rcy;&acy;&kcy;&tcy;&icy;&vcy;&ncy;&ocy;&mcy; &rcy;&iecy;&zhcy;&icy;&mcy;&iecy; &vcy;&ycy;&bcy;&iecy;&rcy;&icy;&tcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ycy; &rcy;&acy;&zcy;&ncy;&icy;&tscy;&ycy; &mcy;&iecy;&zhcy;&dcy;&ucy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ocy;&mcy; &icy;  <code>&lt;tree-ish&gt;</code>  (&pcy;&ocy; &ucy;&mcy;&ocy;&lcy;&chcy;&acy;&ncy;&icy;&yucy;  <code>HEAD</code>  ). &Vcy;&ycy;&bcy;&rcy;&acy;&ncy;&ncy;&ycy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ycy; &pcy;&rcy;&icy;&mcy;&iecy;&ncy;&yacy;&yucy;&tcy;&scy;&yacy; &ocy;&bcy;&rcy;&acy;&tcy;&ncy;&ocy; &pcy;&ocy; &ocy;&tcy;&ncy;&ocy;&shcy;&iecy;&ncy;&icy;&yucy; &kcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ucy;.</span></p> <p><span data-i18n="27b5bf36c73056ec11ba033f0100a161fd1dc61ed5d603213e8eaaad9927b5cc/2b" data-source="This means that &lt;code&gt;git reset -p&lt;/code&gt; is the opposite of &lt;code&gt;git add -p&lt;/code&gt;, i.e. you can use it to selectively reset hunks. See the &amp;ldquo;Interactive Mode&amp;rdquo; section of &lt;a href=&quot;git-add&quot;&gt;git-add[1]&lt;/a&gt; to learn how to operate the &lt;code&gt;--patch&lt;/code&gt; mode." onmousemove="i18n(this)">&Ecy;&tcy;&ocy; &ocy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy;  <code>git reset -p</code>  &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &pcy;&rcy;&ocy;&tcy;&icy;&vcy;&ocy;&pcy;&ocy;&lcy;&ocy;&zhcy;&ncy;&ocy;&scy;&tcy;&softcy;&yucy;  <code>git add -p</code> , &tcy;.&iecy;. &iecy;&gcy;&ocy; &mcy;&ocy;&zhcy;&ncy;&ocy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy; &dcy;&lcy;&yacy; &vcy;&ycy;&bcy;&ocy;&rcy;&ocy;&chcy;&ncy;&ocy;&gcy;&ocy; &scy;&bcy;&rcy;&ocy;&scy;&acy; &khcy;&acy;&ncy;&kcy;&ocy;&vcy;. &Scy;&mcy;. &rcy;&acy;&zcy;&dcy;&iecy;&lcy; &laquo;&Icy;&ncy;&tcy;&iecy;&rcy;&acy;&kcy;&tcy;&icy;&vcy;&ncy;&ycy;&jcy; &rcy;&iecy;&zhcy;&icy;&mcy;&raquo;  <a href="git-add.html">git-add[1]</a> , &chcy;&tcy;&ocy;&bcy;&ycy; &ucy;&zcy;&ncy;&acy;&tcy;&softcy;, &kcy;&acy;&kcy; &rcy;&acy;&bcy;&ocy;&tcy;&acy;&tcy;&softcy; &vcy; &rcy;&iecy;&zhcy;&icy;&mcy;&iecy;  <code>--patch</code> .</span></p> </dd> <dt id="Documentation/git-reset.txt-emgitresetemltmodegtltcommitgt"> <span data-i18n="087e462cede93664b337a5271d55055561a745ddf87a21f138e72220a412fed5/84" data-source="&lt;em&gt;git reset&lt;/em&gt; [&amp;lt;mode&amp;gt;] [&amp;lt;commit&amp;gt;]" onmousemove="i18n(this)">git  &scy;&bcy;&rcy;&ocy;&scy; [&lt;&rcy;&iecy;&zhcy;&icy;&mcy;&gt;] [&lt;&fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yacy;&gt;]</span></dt> <dd> <p><span data-i18n="e1032dba7b462c21a3751ba54acf497e4bda6f626c0796505496a166b3ef6c53/dc" data-source="This form resets the current branch head to &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; and possibly updates the index (resetting it to the tree of &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt;) and the working tree depending on &lt;code&gt;&amp;lt;mode&amp;gt;&lt;/code&gt;. Before the operation, &lt;code&gt;ORIG_HEAD&lt;/code&gt; is set to the tip of the current branch. If &lt;code&gt;&amp;lt;mode&amp;gt;&lt;/code&gt; is omitted, defaults to &lt;code&gt;--mixed&lt;/code&gt;. The &lt;code&gt;&amp;lt;mode&amp;gt;&lt;/code&gt; must be one of the following:" onmousemove="i18n(this)">&Ecy;&tcy;&acy; &fcy;&ocy;&rcy;&mcy;&acy; &scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &tcy;&iecy;&kcy;&ucy;&shchcy;&icy;&jcy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&ocy;&kcy; &vcy;&iecy;&tcy;&kcy;&icy; &ncy;&acy;  <code>&lt;commit&gt;</code>  &icy;, &vcy;&ocy;&zcy;&mcy;&ocy;&zhcy;&ncy;&ocy;, &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&yacy;&iecy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; (&scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&yacy; &iecy;&gcy;&ocy; &ncy;&acy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;  <code>&lt;commit&gt;</code> ) &icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &vcy; &zcy;&acy;&vcy;&icy;&scy;&icy;&mcy;&ocy;&scy;&tcy;&icy; &ocy;&tcy;  <code>&lt;mode&gt;</code> . &Pcy;&iecy;&rcy;&iecy;&dcy; &ocy;&pcy;&iecy;&rcy;&acy;&tscy;&icy;&iecy;&jcy;  <code>ORIG_HEAD</code>  &ucy;&scy;&tcy;&acy;&ncy;&acy;&vcy;&lcy;&icy;&vcy;&acy;&iecy;&tcy;&scy;&yacy; &ncy;&acy; &kcy;&ocy;&ncy;&chcy;&icy;&kcy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy; &vcy;&iecy;&tcy;&kcy;&icy;. &IEcy;&scy;&lcy;&icy;  <code>&lt;mode&gt;</code>  &ocy;&pcy;&ucy;&shchcy;&iecy;&ncy;, &pcy;&ocy; &ucy;&mcy;&ocy;&lcy;&chcy;&acy;&ncy;&icy;&yucy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy;  <code>--mixed</code> .  <code>&lt;mode&gt;</code>  &dcy;&ocy;&lcy;&zhcy;&iecy;&ncy; &bcy;&ycy;&tcy;&softcy; &ocy;&dcy;&ncy;&icy;&mcy; &icy;&zcy; &scy;&lcy;&iecy;&dcy;&ucy;&yucy;&shchcy;&icy;&khcy;:</span></p> <div> <div> <div> <dl> <dt id="Documentation/git-reset.txt---soft"><span data-i18n="74c120c4f470cd73babedcacb6190053b37a9e9cb774898ae5859f04d0bae7d8/ae" data-source="--soft" onmousemove="i18n(this)">--soft</span></dt> <dd> <p><span data-i18n="539a75e8e55572b289a8b3b245f211ecfc3590887b067a1ea3e678c7d66e0b31/91" data-source="Does not touch the index file or the working tree at all (but resets the head to &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt;, just like all modes do). This leaves all your changed files &amp;quot;Changes to be committed&amp;quot;, as &lt;code&gt;git status&lt;/code&gt; would put it." onmousemove="i18n(this)">&Vcy;&ocy;&ocy;&bcy;&shchcy;&iecy; &ncy;&iecy; &tcy;&rcy;&ocy;&gcy;&acy;&iecy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy; &icy;&lcy;&icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; (&ncy;&ocy; &scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &gcy;&ocy;&lcy;&ocy;&vcy;&ucy; &ncy;&acy;  <code>&lt;commit&gt;</code> , &kcy;&acy;&kcy; &icy; &vcy;&scy;&iecy; &rcy;&iecy;&zhcy;&icy;&mcy;&ycy;). &Pcy;&rcy;&icy; &ecy;&tcy;&ocy;&mcy; &vcy;&scy;&iecy; &vcy;&acy;&shcy;&icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&ncy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&ycy; &ocy;&scy;&tcy;&acy;&ncy;&ucy;&tcy;&scy;&yacy;  &quot;Changes to be committed&quot; , &kcy;&acy;&kcy; &vcy;&ycy;&rcy;&acy;&zcy;&icy;&lcy;&scy;&yacy; &bcy;&ycy;  <code>git status</code> .</span></p> </dd> <dt id="Documentation/git-reset.txt---mixed"><span data-i18n="a11a01f62bb5fbcb79324807780407f9471421e8591f9c3d9048f7be718344af/d7" data-source="--mixed" onmousemove="i18n(this)">--mixed</span></dt> <dd> <p><span data-i18n="4fede2b0633bee5ab0efc3f1a32a12d07f13d8accb3cb56a55d89a53f1720bb4/4b" data-source="Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action." onmousemove="i18n(this)">&Scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;, &ncy;&ocy; &ncy;&iecy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; (&tcy;. &iecy;. &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&ncy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&ycy; &scy;&ocy;&khcy;&rcy;&acy;&ncy;&yacy;&yucy;&tcy;&scy;&yacy;, &ncy;&ocy; &ncy;&iecy; &pcy;&ocy;&mcy;&iecy;&chcy;&acy;&yucy;&tcy;&scy;&yacy; &dcy;&lcy;&yacy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;) &icy; &scy;&ocy;&ocy;&bcy;&shchcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy; &ncy;&iecy; &bcy;&ycy;&lcy;&ocy; &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&iecy;&ncy;&ocy;. &Ecy;&tcy;&ocy; &dcy;&iecy;&jcy;&scy;&tcy;&vcy;&icy;&iecy; &pcy;&ocy; &ucy;&mcy;&ocy;&lcy;&chcy;&acy;&ncy;&icy;&yucy;.</span></p> <p><span data-i18n="b0328681a5dd26694e82debf34e4876c77eec0063a1459e8d66fe8e705774bf4/83" data-source="If &lt;code&gt;-N&lt;/code&gt; is specified, removed paths are marked as intent-to-add (see &lt;a href=&quot;git-add&quot;&gt;git-add[1]&lt;/a&gt;)." onmousemove="i18n(this)">&IEcy;&scy;&lcy;&icy; &ucy;&kcy;&acy;&zcy;&acy;&ncy;  <code>-N</code> , &ucy;&dcy;&acy;&lcy;&iecy;&ncy;&ncy;&ycy;&iecy; &pcy;&ucy;&tcy;&icy; &pcy;&ocy;&mcy;&iecy;&chcy;&acy;&yucy;&tcy;&scy;&yacy; &kcy;&acy;&kcy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&yacy;&iecy;&mcy;&ycy;&iecy; (&scy;&mcy;.  <a href="git-add.html">git-add[1]</a> ).</span></p> </dd> <dt id="Documentation/git-reset.txt---hard"><span data-i18n="1d6bae73cb120bba1f381a2a7b1cfe616f0ef8da2b99a86bc275380ac2aa6dd4/6e" data-source="--hard" onmousemove="i18n(this)">--hard</span></dt> <dd> <p><span data-i18n="89791e528fe7a77e98ab9ff7440bec94a69f6e019c0ae54976d5886641a7cbe9/7b" data-source="Resets the index and working tree. Any changes to tracked files in the working tree since &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted." onmousemove="i18n(this)">&Scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;. &Lcy;&yucy;&bcy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &ocy;&tcy;&scy;&lcy;&iecy;&zhcy;&icy;&vcy;&acy;&iecy;&mcy;&ycy;&khcy; &fcy;&acy;&jcy;&lcy;&acy;&khcy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &ncy;&acy;&chcy;&icy;&ncy;&acy;&yacy; &scy;  <code>&lt;commit&gt;</code> , &ocy;&tcy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&yucy;&tcy;&scy;&yacy;. &Lcy;&yucy;&bcy;&ycy;&iecy; &ncy;&iecy;&ocy;&tcy;&scy;&lcy;&iecy;&zhcy;&icy;&vcy;&acy;&iecy;&mcy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&ycy; &icy;&lcy;&icy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&icy; &ncy;&acy; &pcy;&ucy;&tcy;&icy; &zcy;&acy;&pcy;&icy;&scy;&icy; &lcy;&yucy;&bcy;&ycy;&khcy; &ocy;&tcy;&scy;&lcy;&iecy;&zhcy;&icy;&vcy;&acy;&iecy;&mcy;&ycy;&khcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &pcy;&rcy;&ocy;&scy;&tcy;&ocy; &ucy;&dcy;&acy;&lcy;&yacy;&yucy;&tcy;&scy;&yacy;.</span></p> </dd> <dt id="Documentation/git-reset.txt---merge"><span data-i18n="8fb0e06813ad30153047701775d50b3c457f0df427ea7a690312a21a2e94ea2d/e9" data-source="--merge" onmousemove="i18n(this)">--merge</span></dt> <dd> <p><span data-i18n="af8b44bff5f0d7406da0f2b11a1c10b1991292314a7cb47a71d5a6c2fc6601d6/d3" data-source="Resets the index and updates the files in the working tree that are different between &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; and &lt;code&gt;HEAD&lt;/code&gt;, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). If a file that is different between &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; and the index has unstaged changes, reset is aborted." onmousemove="i18n(this)">&Scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &icy; &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&yacy;&iecy;&tcy; &fcy;&acy;&jcy;&lcy;&ycy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&acy;&yucy;&tcy;&scy;&yacy; &mcy;&iecy;&zhcy;&dcy;&ucy;  <code>&lt;commit&gt;</code>  &icy;  <code>HEAD</code> , &ncy;&ocy; &scy;&ocy;&khcy;&rcy;&acy;&ncy;&yacy;&iecy;&tcy; &tcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&acy;&yucy;&tcy;&scy;&yacy; &mcy;&iecy;&zhcy;&dcy;&ucy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ocy;&mcy; &icy; &rcy;&acy;&bcy;&ocy;&chcy;&icy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;&mcy; (&tcy;. &iecy;. &icy;&mcy;&iecy;&yucy;&tcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &ncy;&iecy; &bcy;&ycy;&lcy;&icy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&iecy;&ncy;&ycy;). &IEcy;&scy;&lcy;&icy; &fcy;&acy;&jcy;&lcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &ocy;&tcy;&lcy;&icy;&chcy;&acy;&iecy;&tcy;&scy;&yacy; &mcy;&iecy;&zhcy;&dcy;&ucy;  <code>&lt;commit&gt;</code>  &icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ocy;&mcy;, &icy;&mcy;&iecy;&iecy;&tcy; &ncy;&iecy;&ucy;&scy;&tcy;&acy;&ncy;&ocy;&vcy;&lcy;&iecy;&ncy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &scy;&bcy;&rcy;&ocy;&scy; &pcy;&rcy;&iecy;&rcy;&ycy;&vcy;&acy;&iecy;&tcy;&scy;&yacy;.</span></p> <p><span data-i18n="c8fdf15a4bc7095fa5c9777f7b13d90a6aeffd89f437518ec5a45421cdedbec6/23" data-source="In other words, &lt;code&gt;--merge&lt;/code&gt; does something like a &lt;code&gt;git read-tree -u -m &amp;lt;commit&amp;gt;&lt;/code&gt;, but carries forward unmerged index entries." onmousemove="i18n(this)">&Dcy;&rcy;&ucy;&gcy;&icy;&mcy;&icy; &scy;&lcy;&ocy;&vcy;&acy;&mcy;&icy;,  <code>--merge</code>  &dcy;&iecy;&lcy;&acy;&iecy;&tcy; &chcy;&tcy;&ocy;-&tcy;&ocy; &vcy;&rcy;&ocy;&dcy;&iecy;  <code>git read-tree -u -m &lt;commit&gt;</code> , &ncy;&ocy; &pcy;&iecy;&rcy;&iecy;&ncy;&ocy;&scy;&icy;&tcy; &ncy;&iecy;&scy;&lcy;&icy;&tcy;&ycy;&iecy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy;.</span></p> </dd> <dt id="Documentation/git-reset.txt---keep"><span data-i18n="ad8e4cbae591ad249ce8e2aba49d9676fbb2a16a7520506a682b1418ae1ad979/0b" data-source="--keep" onmousemove="i18n(this)">--keep</span></dt> <dd> <p><span data-i18n="5ee0b67bebe92b6aadcbc6d77938becb14f9058642f6e4e07f9c81bf132aae44/67" data-source="Resets index entries and updates files in the working tree that are different between &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; and &lt;code&gt;HEAD&lt;/code&gt;. If a file that is different between &lt;code&gt;&amp;lt;commit&amp;gt;&lt;/code&gt; and &lt;code&gt;HEAD&lt;/code&gt; has local changes, reset is aborted." onmousemove="i18n(this)">&Scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy; &icy; &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&yacy;&iecy;&tcy; &fcy;&acy;&jcy;&lcy;&ycy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&acy;&yucy;&tcy;&scy;&yacy; &mcy;&iecy;&zhcy;&dcy;&ucy;  <code>&lt;commit&gt;</code>  &icy;  <code>HEAD</code> . &IEcy;&scy;&lcy;&icy; &fcy;&acy;&jcy;&lcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &ocy;&tcy;&lcy;&icy;&chcy;&acy;&iecy;&tcy;&scy;&yacy; &mcy;&iecy;&zhcy;&dcy;&ucy;  <code>&lt;commit&gt;</code>  &icy;  <code>HEAD</code> , &icy;&mcy;&iecy;&iecy;&tcy; &lcy;&ocy;&kcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &scy;&bcy;&rcy;&ocy;&scy; &pcy;&rcy;&iecy;&rcy;&ycy;&vcy;&acy;&iecy;&tcy;&scy;&yacy;.</span></p> </dd> <dt id="Documentation/git-reset.txt---no-recurse-submodules"><span data-i18n="8f0e0394b85d15f0eead5d59c6380d107a0dc41411de7a6b5d973ea0ccb077e4/64" data-source="--[no-]recurse-submodules" onmousemove="i18n(this)">--[no-]recurse-submodules</span></dt> <dd> <p><span data-i18n="25e896b29a4423ff660ee2214654786114b7dc57c006c4443f92742604d7ba52/7b" data-source="When the working tree is updated, using --recurse-submodules will also recursively reset the working tree of all active submodules according to the commit recorded in the superproject, also setting the submodules&amp;apos; HEAD to be detached at that commit." onmousemove="i18n(this)">&Kcy;&ocy;&gcy;&dcy;&acy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy;, &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&ncy;&icy;&iecy; --recurse-submodules &tcy;&acy;&kcy;&zhcy;&iecy; &rcy;&iecy;&kcy;&ucy;&rcy;&scy;&icy;&vcy;&ncy;&ocy; &scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &vcy;&scy;&iecy;&khcy; &acy;&kcy;&tcy;&icy;&vcy;&ncy;&ycy;&khcy; &pcy;&ocy;&dcy;&mcy;&ocy;&dcy;&ucy;&lcy;&iecy;&jcy; &vcy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&icy;&icy; &scy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&mcy;, &zcy;&acy;&pcy;&icy;&scy;&acy;&ncy;&ncy;&ycy;&mcy; &vcy; &scy;&ucy;&pcy;&iecy;&rcy;&pcy;&rcy;&ocy;&iecy;&kcy;&tcy;&iecy;, &acy; &tcy;&acy;&kcy;&zhcy;&iecy; &ucy;&scy;&tcy;&acy;&ncy;&acy;&vcy;&lcy;&icy;&vcy;&acy;&iecy;&tcy; &ocy;&tcy;&scy;&ocy;&iecy;&dcy;&icy;&ncy;&iecy;&ncy;&icy;&iecy; HEAD &pcy;&ocy;&dcy;&mcy;&ocy;&dcy;&ucy;&lcy;&iecy;&jcy; &pcy;&rcy;&icy; &ecy;&tcy;&ocy;&mcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&iecy;.</span></p> </dd> </dl> </div> </div> </div> </dd> </dl> </div> <p><span data-i18n="465463e46081ba85fcd60b7d2bdfd9e4c6922ac704c441a1afd9ef1e011b3450/cd" data-source="See &amp;quot;Reset, restore and revert&amp;quot; in &lt;a href=&quot;git&quot;&gt;git[1]&lt;/a&gt; for the differences between the three commands." onmousemove="i18n(this)">&Scy;&mcy;.  &quot;Reset, restore and revert&quot;  &vcy;  <a href="git.html">git[1]</a> , &chcy;&tcy;&ocy;&bcy;&ycy; &ucy;&zcy;&ncy;&acy;&tcy;&softcy; &ocy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&icy;&yacy;&khcy; &mcy;&iecy;&zhcy;&dcy;&ucy; &tcy;&rcy;&iecy;&mcy;&yacy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;&acy;&mcy;&icy;.</span></p> </div> <h2 class="text-body-emphasis"  id="_options"><span data-i18n="d0db8b5e364b6989e4b8f38a2b3846b87d99a51c1592ebf35d21cc66405a8e39/b6" data-source="Options" onmousemove="i18n(this)">Options</span></h2> <div> <div> <dl> <dt id="Documentation/git-reset.txt--q"><span data-i18n="5ce681666a15a41274346f65b8bcbf56f8e8170ac00706a44a09ee4d786a8609/cd" data-source="-q" onmousemove="i18n(this)">-q</span></dt> <dt id="Documentation/git-reset.txt---quiet"><span data-i18n="b00818cdc507640687732769ee1cb501db377927ee76d03df23978bd0d706888/e2" data-source="--quiet" onmousemove="i18n(this)">--quiet</span></dt> <dd> <p><span data-i18n="1955bfafe9408aec639739cb27f38e69365e07f7f7a1ba277e7c4ca313327406/b4" data-source="Be quiet, only report errors." onmousemove="i18n(this)">&Mcy;&ocy;&lcy;&chcy;&icy;&tcy;&iecy;, &scy;&ocy;&ocy;&bcy;&shchcy;&acy;&jcy;&tcy;&iecy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &ocy;&bcy; &ocy;&shcy;&icy;&bcy;&kcy;&acy;&khcy;.</span></p> </dd> <dt id="Documentation/git-reset.txt---refresh"><span data-i18n="a6d6ecebdbbbb2bf54a00053474e141799c356419f3feb04a5049dac11d05821/2b" data-source="--refresh" onmousemove="i18n(this)">--refresh</span></dt> <dt id="Documentation/git-reset.txt---no-refresh"><span data-i18n="4f2a9722f00911f8c6acfa11fef5b4d7eaaf63cf4f7a2e8eaf4df89aec060698/9a" data-source="--no-refresh" onmousemove="i18n(this)">--no-refresh</span></dt> <dd> <p><span data-i18n="ef030d92c6e110805bb56feac565981a306574a71f506fa1ff6dbceb6be8ea97/a2" data-source="Refresh the index after a mixed reset. Enabled by default." onmousemove="i18n(this)">&Ocy;&bcy;&ncy;&ocy;&vcy;&icy;&tcy;&iecy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &pcy;&ocy;&scy;&lcy;&iecy; &scy;&mcy;&iecy;&shcy;&acy;&ncy;&ncy;&ocy;&gcy;&ocy; &scy;&bcy;&rcy;&ocy;&scy;&acy;. &Vcy;&kcy;&lcy;&yucy;&chcy;&iecy;&ncy;&ocy; &pcy;&ocy; &ucy;&mcy;&ocy;&lcy;&chcy;&acy;&ncy;&icy;&yucy;.</span></p> </dd> <dt id="Documentation/git-reset.txt---pathspec-from-fileltfilegt"><span data-i18n="da8857eb3d44efb4cdb38781f7cc2d2dd9074dc3c2a6ca51bd424135fedabfd0/18" data-source="--pathspec-from-file=&amp;lt;file&amp;gt;" onmousemove="i18n(this)">--pathspec-from-file=&lt;file&gt;</span></dt> <dd> <p><span data-i18n="edbea5c504ccb9748dfc5d09bca08d1600446d3e324d8503642ae08801e92fce/7b" data-source="Pathspec is passed in &lt;code&gt;&amp;lt;file&amp;gt;&lt;/code&gt; instead of commandline args. If &lt;code&gt;&amp;lt;file&amp;gt;&lt;/code&gt; is exactly &lt;code&gt;-&lt;/code&gt; then standard input is used. Pathspec elements are separated by LF or CR/LF. Pathspec elements can be quoted as explained for the configuration variable &lt;code&gt;core.quotePath&lt;/code&gt; (see &lt;a href=&quot;git-config&quot;&gt;git-config[1]&lt;/a&gt;). See also &lt;code&gt;--pathspec-file-nul&lt;/code&gt; and global &lt;code&gt;--literal-pathspecs&lt;/code&gt;." onmousemove="i18n(this)">&Scy;&pcy;&iecy;&tscy;&icy;&fcy;&icy;&kcy;&acy;&tscy;&icy;&yacy; &pcy;&ucy;&tcy;&icy; &pcy;&iecy;&rcy;&iecy;&dcy;&acy;&iecy;&tcy;&scy;&yacy; &vcy;  <code>&lt;file&gt;</code>  &vcy;&mcy;&iecy;&scy;&tcy;&ocy; &acy;&rcy;&gcy;&ucy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;&ncy;&ocy;&jcy; &scy;&tcy;&rcy;&ocy;&kcy;&icy;. &IEcy;&scy;&lcy;&icy;  <code>&lt;file&gt;</code>  &mdash; &ecy;&tcy;&ocy; &tcy;&ocy;&chcy;&ncy;&ocy;  <code>-</code> , &tcy;&ocy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &scy;&tcy;&acy;&ncy;&dcy;&acy;&rcy;&tcy;&ncy;&ycy;&jcy; &vcy;&vcy;&ocy;&dcy;. &Ecy;&lcy;&iecy;&mcy;&iecy;&ncy;&tcy;&ycy; Pathspec &rcy;&acy;&zcy;&dcy;&iecy;&lcy;&yacy;&yucy;&tcy;&scy;&yacy; LF &icy;&lcy;&icy; CR/LF. &Ecy;&lcy;&iecy;&mcy;&iecy;&ncy;&tcy;&ycy; Pathspec &mcy;&ocy;&zhcy;&ncy;&ocy; &zcy;&acy;&kcy;&lcy;&yucy;&chcy;&acy;&tcy;&softcy; &vcy; &kcy;&acy;&vcy;&ycy;&chcy;&kcy;&icy;, &kcy;&acy;&kcy; &ocy;&pcy;&icy;&scy;&acy;&ncy;&ocy; &dcy;&lcy;&yacy; &pcy;&iecy;&rcy;&iecy;&mcy;&iecy;&ncy;&ncy;&ocy;&jcy; &kcy;&ocy;&ncy;&fcy;&icy;&gcy;&ucy;&rcy;&acy;&tscy;&icy;&icy;  <code>core.quotePath</code>  (&scy;&mcy;.  <a href="git-config.html">git-config[1]</a> ). &Scy;&mcy;. &tcy;&acy;&kcy;&zhcy;&iecy;  <code>--pathspec-file-nul</code>  &icy; &gcy;&lcy;&ocy;&bcy;&acy;&lcy;&softcy;&ncy;&ycy;&jcy;  <code>--literal-pathspecs</code> .</span></p> </dd> <dt id="Documentation/git-reset.txt---pathspec-file-nul"><span data-i18n="425e5942f80034f1f089327693cf66158c953fde8f89bae24b0fbc651b9af0e9/1a" data-source="--pathspec-file-nul" onmousemove="i18n(this)">--pathspec-file-nul</span></dt> <dd> <p><span data-i18n="7e27df84b5773075cf108a34f1dc37f2f6a47f96c09842b70ed9d300ad32e7c1/c3" data-source="Only meaningful with &lt;code&gt;--pathspec-from-file&lt;/code&gt;. Pathspec elements are separated with NUL character and all other characters are taken literally (including newlines and quotes)." onmousemove="i18n(this)">&Icy;&mcy;&iecy;&iecy;&tcy; &scy;&mcy;&ycy;&scy;&lcy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &scy;  <code>--pathspec-from-file</code> . &Ecy;&lcy;&iecy;&mcy;&iecy;&ncy;&tcy;&ycy; Pathspec &rcy;&acy;&zcy;&dcy;&iecy;&lcy;&yacy;&yucy;&tcy;&scy;&yacy; &scy;&icy;&mcy;&vcy;&ocy;&lcy;&ocy;&mcy; NUL, &acy; &vcy;&scy;&iecy; &ocy;&scy;&tcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &scy;&icy;&mcy;&vcy;&ocy;&lcy;&ycy; &vcy;&ocy;&scy;&pcy;&rcy;&icy;&ncy;&icy;&mcy;&acy;&yucy;&tcy;&scy;&yacy; &bcy;&ucy;&kcy;&vcy;&acy;&lcy;&softcy;&ncy;&ocy; (&vcy;&kcy;&lcy;&yucy;&chcy;&acy;&yacy; &scy;&icy;&mcy;&vcy;&ocy;&lcy;&ycy; &ncy;&ocy;&vcy;&ocy;&jcy; &scy;&tcy;&rcy;&ocy;&kcy;&icy; &icy; &kcy;&acy;&vcy;&ycy;&chcy;&kcy;&icy;).</span></p> </dd> <dt id="Documentation/git-reset.txt---"><span data-i18n="d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c/71" data-source="--" onmousemove="i18n(this)">--</span></dt> <dd> <p><span data-i18n="0ea53dd4a1fb9384edae11ed9c03b5411457806a0ae358d444eb80e48fbc0c0c/07" data-source="Do not interpret any more arguments as options." onmousemove="i18n(this)">&Ncy;&iecy; &icy;&ncy;&tcy;&iecy;&rcy;&pcy;&rcy;&iecy;&tcy;&icy;&rcy;&ucy;&jcy;&tcy;&iecy; &dcy;&ocy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ycy;&iecy; &acy;&rcy;&gcy;&ucy;&mcy;&iecy;&ncy;&tcy;&ycy; &kcy;&acy;&kcy; &vcy;&acy;&rcy;&icy;&acy;&ncy;&tcy;&ycy;.</span></p> </dd> <dt id="Documentation/git-reset.txt-ltpathspecgt82308203"><span data-i18n="5c5493d0791d7f222f3401382dbca513ccb6d257ea0ecc4d926b47bd7c332f5f/89" data-source="&amp;lt;pathspec&amp;gt;&amp;hellip;" onmousemove="i18n(this)">&lt;pathspec&gt;&hellip;</span></dt> <dd> <p><span data-i18n="b65e71126afbf536240ddd20bc10384980e807f79d166373fdf224161b686b4e/b6" data-source="Limits the paths affected by the operation." onmousemove="i18n(this)">&Ocy;&gcy;&rcy;&acy;&ncy;&icy;&chcy;&icy;&vcy;&acy;&iecy;&tcy; &pcy;&ucy;&tcy;&icy;, &ncy;&acy; &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &vcy;&lcy;&icy;&yacy;&iecy;&tcy; &ocy;&pcy;&iecy;&rcy;&acy;&tscy;&icy;&yacy;.</span></p> <p><span data-i18n="650607ea17f595aebbbfe78f73f3a97d6140cbf9f4b2d78e76db3388abadf879/ee" data-source="For more details, see the &lt;code&gt;pathspec&lt;/code&gt; entry in &lt;a href=&quot;gitglossary&quot;&gt;gitglossary[7]&lt;/a&gt;." onmousemove="i18n(this)">&Dcy;&ocy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ycy;&iecy; &scy;&vcy;&iecy;&dcy;&iecy;&ncy;&icy;&yacy; &scy;&mcy;. &vcy; &zcy;&acy;&pcy;&icy;&scy;&icy;  <code>pathspec</code>  &vcy;  <a href="gitglossary.html">gitglossary[7]</a> .</span></p> </dd> </dl> </div> </div> <h2 class="text-body-emphasis"  id="_examples"><span data-i18n="e68ee04dff59551b7d1ae07a2f8a00dc61d841628948da3d2781630706a05e92/38" data-source="Examples" onmousemove="i18n(this)">Examples</span></h2> <div> <div> <dl> <dt id="Documentation/git-reset.txt-Undoadd"><span data-i18n="4175284f340a661c504549f2670de1107a3e16b2b2e0dd0b1f5eb3643f597c77/28" data-source="Undo add" onmousemove="i18n(this)">Undo add</span></dt> <dd> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>edit                                     (<span class="hljs-number">1</span>)
<span class="hljs-variable">$ </span>git add frotz.c filfre.c
<span class="hljs-variable">$ </span>mailx                                    (<span class="hljs-number">2</span>)
<span class="hljs-variable">$ </span>git reset                                (<span class="hljs-number">3</span>)
<span class="hljs-variable">$ </span>git pull <span class="hljs-symbol">git:</span>/<span class="hljs-regexp">/info.example.com/</span> nitfol  (<span class="hljs-number">4</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="e8afca3312df5c1ac8535c799c01989188ff23f672911a85a85b61f3d61756ba/b7" data-source="You are happily working on something, and find the changes in these files are in good order. You do not want to see them when you run &lt;code&gt;git diff&lt;/code&gt;, because you plan to work on other files and changes with these files are distracting." onmousemove="i18n(this)">&Vcy;&ycy; &scy; &ucy;&dcy;&ocy;&vcy;&ocy;&lcy;&softcy;&scy;&tcy;&vcy;&icy;&iecy;&mcy; &ncy;&acy;&dcy; &chcy;&iecy;&mcy;-&tcy;&ocy; &rcy;&acy;&bcy;&ocy;&tcy;&acy;&iecy;&tcy;&iecy; &icy; &ocy;&bcy;&ncy;&acy;&rcy;&ucy;&zhcy;&icy;&vcy;&acy;&iecy;&tcy;&iecy;, &chcy;&tcy;&ocy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &ecy;&tcy;&icy;&khcy; &fcy;&acy;&jcy;&lcy;&acy;&khcy; &vcy; &pcy;&ocy;&rcy;&yacy;&dcy;&kcy;&iecy;. &Vcy;&ycy; &ncy;&iecy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy; &vcy;&icy;&dcy;&iecy;&tcy;&softcy; &icy;&khcy; &pcy;&rcy;&icy; &zcy;&acy;&pcy;&ucy;&scy;&kcy;&iecy;  <code>git diff</code> , &pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &vcy;&ycy; &pcy;&lcy;&acy;&ncy;&icy;&rcy;&ucy;&iecy;&tcy;&iecy; &rcy;&acy;&bcy;&ocy;&tcy;&acy;&tcy;&softcy; &scy; &dcy;&rcy;&ucy;&gcy;&icy;&mcy;&icy; &fcy;&acy;&jcy;&lcy;&acy;&mcy;&icy; &icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &ecy;&tcy;&icy;&khcy; &fcy;&acy;&jcy;&lcy;&acy;&khcy; &ocy;&tcy;&vcy;&lcy;&iecy;&kcy;&acy;&yucy;&tcy;.</span></p> </li> <li> <p><span data-i18n="c8154ee6f362aa2ae74e6538f2708321e9015d4dc1c6e0a522d39a0a11fe1f96/08" data-source="Somebody asks you to pull, and the changes sound worthy of merging." onmousemove="i18n(this)">&Kcy;&tcy;&ocy;-&tcy;&ocy; &pcy;&rcy;&ocy;&scy;&icy;&tcy; &vcy;&acy;&scy; &pcy;&ocy;&tcy;&yacy;&ncy;&ucy;&tcy;&softcy;, &icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &kcy;&acy;&zhcy;&ucy;&tcy;&scy;&yacy; &dcy;&ocy;&scy;&tcy;&ocy;&jcy;&ncy;&ycy;&mcy;&icy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy;.</span></p> </li> <li> <p><span data-i18n="a4ccd1d652f8773c607788f65e8c7214c3c5dfa3f7c5e4c267a4b449c85d013f/ff" data-source="However, you already dirtied the index (i.e. your index does not match the &lt;code&gt;HEAD&lt;/code&gt; commit). But you know the pull you are going to make does not affect &lt;code&gt;frotz.c&lt;/code&gt; or &lt;code&gt;filfre.c&lt;/code&gt;, so you revert the index changes for these two files. Your changes in working tree remain there." onmousemove="i18n(this)">&Ocy;&dcy;&ncy;&acy;&kcy;&ocy; &vcy;&ycy; &ucy;&zhcy;&iecy; &icy;&scy;&pcy;&ocy;&rcy;&tcy;&icy;&lcy;&icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; (&tcy;.&iecy;. &vcy;&acy;&shcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &ncy;&iecy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&ucy;&iecy;&tcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ucy;  <code>HEAD</code> ). &Ncy;&ocy; &vcy;&ycy; &zcy;&ncy;&acy;&iecy;&tcy;&iecy;, &chcy;&tcy;&ocy; &vcy;&ycy;&tcy;&yacy;&gcy;&icy;&vcy;&acy;&ncy;&icy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&iecy; &vcy;&ycy; &scy;&ocy;&bcy;&icy;&rcy;&acy;&iecy;&tcy;&iecy;&scy;&softcy; &scy;&dcy;&iecy;&lcy;&acy;&tcy;&softcy;, &ncy;&iecy; &vcy;&lcy;&icy;&yacy;&iecy;&tcy; &ncy;&acy;  <code>frotz.c</code>  &icy;&lcy;&icy;  <code>filfre.c</code> , &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &vcy;&ycy; &ocy;&tcy;&mcy;&iecy;&ncy;&yacy;&iecy;&tcy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy; &dcy;&lcy;&yacy; &ecy;&tcy;&icy;&khcy; &dcy;&vcy;&ucy;&khcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy;. &Vcy;&acy;&shcy;&icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy; &ocy;&scy;&tcy;&acy;&yucy;&tcy;&scy;&yacy; &tcy;&acy;&mcy;.</span></p> </li> <li> <p><span data-i18n="b6aa7ceb774ccabcf6bf29e139ec4917a0b58488d250af8aa3e0afdad3703377/2d" data-source="Then you can pull and merge, leaving &lt;code&gt;frotz.c&lt;/code&gt; and &lt;code&gt;filfre.c&lt;/code&gt; changes still in the working tree." onmousemove="i18n(this)">&Zcy;&acy;&tcy;&iecy;&mcy; &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &icy;&zcy;&vcy;&lcy;&iecy;&chcy;&softcy; &icy; &ocy;&bcy;&hardcy;&iecy;&dcy;&icy;&ncy;&icy;&tcy;&softcy;, &ocy;&scy;&tcy;&acy;&vcy;&icy;&vcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;  <code>frotz.c</code>  &icy;  <code>filfre.c</code>  &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;.</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Undoacommitandredo"><span data-i18n="49fb837362e9a4e64311e44b94a6bc28db0709802198f27a71a1333fc0f045ae/37" data-source="Undo a commit and redo" onmousemove="i18n(this)">&Ocy;&tcy;&mcy;&iecy;&ncy;&icy;&tcy;&softcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy; &icy; &pcy;&ocy;&vcy;&tcy;&ocy;&rcy;&icy;&tcy;&softcy;</span></dt> <dd> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git commit ...
<span class="hljs-variable">$ </span>git reset --soft <span class="hljs-variable constant_">HEAD</span>^      (<span class="hljs-number">1</span>)
<span class="hljs-variable">$ </span>edit                        (<span class="hljs-number">2</span>)
<span class="hljs-variable">$ </span>git commit -a -c <span class="hljs-variable constant_">ORIG_HEAD</span>  (<span class="hljs-number">3</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="d0581ca4620f808a31f214864a254bfa1595555c0f3cf63732976cdd72427dc0/ad" data-source="This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before &amp;quot;reset&amp;quot;." onmousemove="i18n(this)">&CHcy;&acy;&shchcy;&iecy; &vcy;&scy;&iecy;&gcy;&ocy; &ecy;&tcy;&ocy; &dcy;&iecy;&lcy;&acy;&iecy;&tcy;&scy;&yacy;, &kcy;&ocy;&gcy;&dcy;&acy; &vcy;&ycy; &pcy;&ocy;&mcy;&ncy;&icy;&tcy;&iecy;, &chcy;&tcy;&ocy; &tcy;&ocy;, &chcy;&tcy;&ocy; &vcy;&ycy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &chcy;&tcy;&ocy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&lcy;&icy;, &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &ncy;&iecy;&pcy;&ocy;&lcy;&ncy;&ycy;&mcy;, &icy;&lcy;&icy; &vcy;&ycy; &dcy;&ocy;&pcy;&ucy;&scy;&tcy;&icy;&lcy;&icy; &ocy;&shcy;&icy;&bcy;&kcy;&ucy; &vcy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&icy; &ocy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &icy;&lcy;&icy; &icy; &tcy;&ocy;, &icy; &dcy;&rcy;&ucy;&gcy;&ocy;&iecy;. &Ocy;&scy;&tcy;&acy;&vcy;&lcy;&yacy;&iecy;&tcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &tcy;&acy;&kcy;&icy;&mcy;, &kcy;&acy;&kcy;&icy;&mcy; &ocy;&ncy;&ocy; &bcy;&ycy;&lcy;&ocy; &dcy;&ocy;  &quot;reset&quot; .</span></p> </li> <li> <p><span data-i18n="d0ab92dbc8ef9b36d140dad457f4b16ca8841e5a2fba267a46ad4e78350a1b79/e9" data-source="Make corrections to working tree files." onmousemove="i18n(this)">&Vcy;&ncy;&iecy;&scy;&icy;&tcy;&iecy; &icy;&scy;&pcy;&rcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy; &vcy; &fcy;&acy;&jcy;&lcy;&ycy; &rcy;&acy;&bcy;&ocy;&chcy;&icy;&khcy; &dcy;&iecy;&rcy;&iecy;&vcy;&softcy;&iecy;&vcy;.</span></p> </li> <li> <p><span data-i18n="88d4740148e023a452d6563b3a9cd837858ca03bd80925a1cafc0baeccb44584/42" data-source="&amp;quot;reset&amp;quot; copies the old head to &lt;code&gt;.git/ORIG_HEAD&lt;/code&gt;; redo the commit by starting with its log message. If you do not need to edit the message further, you can give &lt;code&gt;-C&lt;/code&gt; option instead." onmousemove="i18n(this)">&quot;reset&quot;  &kcy;&ocy;&pcy;&icy;&rcy;&ucy;&iecy;&tcy; &scy;&tcy;&acy;&rcy;&ucy;&yucy; &gcy;&ocy;&lcy;&ocy;&vcy;&kcy;&ucy; &vcy;  <code>.git/ORIG_HEAD</code> ; &pcy;&ocy;&vcy;&tcy;&ocy;&rcy;&icy;&tcy;&softcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;, &ncy;&acy;&chcy;&acy;&vcy; &scy; &iecy;&iecy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&yacy; &vcy; &zhcy;&ucy;&rcy;&ncy;&acy;&lcy;&iecy;. &IEcy;&scy;&lcy;&icy; &vcy;&acy;&mcy; &ncy;&iecy; &ncy;&ucy;&zhcy;&ncy;&ocy; &dcy;&acy;&lcy;&softcy;&shcy;&iecy; &rcy;&iecy;&dcy;&acy;&kcy;&tcy;&icy;&rcy;&ocy;&vcy;&acy;&tcy;&softcy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&iecy;, &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &vcy;&mcy;&iecy;&scy;&tcy;&ocy; &ecy;&tcy;&ocy;&gcy;&ocy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&softcy; &ocy;&pcy;&tscy;&icy;&yucy;  <code>-C</code> .</span></p> </li> </ol> </div> <p><span data-i18n="d7bacf13c27c345937e3062c8a10f6e918fc65a947cf3c289c017399bd56c35c/a6" data-source="See also the &lt;code&gt;--amend&lt;/code&gt; option to &lt;a href=&quot;git-commit&quot;&gt;git-commit[1]&lt;/a&gt;." onmousemove="i18n(this)">&Scy;&mcy;. &tcy;&acy;&kcy;&zhcy;&iecy; &vcy;&acy;&rcy;&icy;&acy;&ncy;&tcy;  <code>--amend</code>  &dcy;&lcy;&yacy;  <a href="git-commit.html">git-commit[1]</a> .</span></p> </dd> <dt id="Documentation/git-reset.txt-Undoacommitmakingitatopicbranch"><span data-i18n="5e09ea0295fe8dd8bc11ecd22c351dbf79d1e71acc080ec92a734981d222d570/82" data-source="Undo a commit, making it a topic branch" onmousemove="i18n(this)">&Ocy;&tcy;&mcy;&iecy;&ncy;&icy;&tcy;&softcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &scy;&dcy;&iecy;&lcy;&acy;&vcy; &iecy;&gcy;&ocy; &tcy;&iecy;&mcy;&acy;&tcy;&icy;&chcy;&iecy;&scy;&kcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&ocy;&jcy;</span></dt> <dd> <div> <div> <pre class="hljs language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">git branch topic/wip          (1)</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git reset --hard HEAD~3       (2)</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git switch topic/wip          (3)</span></pre> </div> </div> <div> <ol> <li> <p><span data-i18n="7e0af1ae6c95f15f5cbb72f8041c11dc7cbd205e8203dcc2a3bed08e4eb04770/be" data-source="You have made some commits, but realize they were premature to be in the &lt;code&gt;master&lt;/code&gt; branch. You want to continue polishing them in a topic branch, so create &lt;code&gt;topic/wip&lt;/code&gt; branch off of the current &lt;code&gt;HEAD&lt;/code&gt;." onmousemove="i18n(this)">&Vcy;&ycy; &scy;&dcy;&iecy;&lcy;&acy;&lcy;&icy; &ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ycy;, &ncy;&ocy; &pcy;&ocy;&ncy;&icy;&mcy;&acy;&iecy;&tcy;&iecy;, &chcy;&tcy;&ocy; &icy;&khcy; &pcy;&ocy;&yacy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy; &vcy; &vcy;&iecy;&tcy;&kcy;&iecy;  <code>master</code>  &bcy;&ycy;&lcy;&ocy; &pcy;&rcy;&iecy;&zhcy;&dcy;&iecy;&vcy;&rcy;&iecy;&mcy;&iecy;&ncy;&ncy;&ycy;&mcy;. &Vcy;&ycy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy; &pcy;&rcy;&ocy;&dcy;&ocy;&lcy;&zhcy;&icy;&tcy;&softcy; &icy;&khcy; &dcy;&ocy;&rcy;&acy;&bcy;&ocy;&tcy;&kcy;&ucy; &vcy; &tcy;&iecy;&mcy;&acy;&tcy;&icy;&chcy;&iecy;&scy;&kcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&iecy;, &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &scy;&ocy;&zcy;&dcy;&acy;&jcy;&tcy;&iecy; &vcy;&iecy;&tcy;&kcy;&ucy;  <code>topic/wip</code>  &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy;  <code>HEAD</code> .</span></p> </li> <li> <p><span data-i18n="f9e0a4ccdf0b4897fe44453fec3e38d7b4b07d2445baf627ed41c24edafaa614/81" data-source="Rewind the master branch to get rid of those three commits." onmousemove="i18n(this)">&Pcy;&iecy;&rcy;&iecy;&mcy;&ocy;&tcy;&acy;&jcy;&tcy;&iecy; &vcy;&iecy;&tcy;&kcy;&ucy; master, &chcy;&tcy;&ocy;&bcy;&ycy; &icy;&zcy;&bcy;&acy;&vcy;&icy;&tcy;&softcy;&scy;&yacy; &ocy;&tcy; &ecy;&tcy;&icy;&khcy; &tcy;&rcy;&iocy;&khcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;.</span></p> </li> <li> <p><span data-i18n="c7a38e44e3db5c144d0f2c6657b1283f3a85ba8453214159494f03b3e61ac767/4d" data-source="Switch to &lt;code&gt;topic/wip&lt;/code&gt; branch and keep working." onmousemove="i18n(this)">&Pcy;&iecy;&rcy;&iecy;&kcy;&lcy;&yucy;&chcy;&icy;&tcy;&iecy;&scy;&softcy; &ncy;&acy; &vcy;&iecy;&tcy;&kcy;&ucy;  <code>topic/wip</code>  &icy; &pcy;&rcy;&ocy;&dcy;&ocy;&lcy;&zhcy;&acy;&jcy;&tcy;&iecy; &rcy;&acy;&bcy;&ocy;&tcy;&ucy;.</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Undocommitspermanently"><span data-i18n="c963bf8d4c8014953b069e47c97c272cf803f0626f3e3aedddc1c6fb5621a426/3a" data-source="Undo commits permanently" onmousemove="i18n(this)">&Ocy;&tcy;&mcy;&iecy;&ncy;&icy;&tcy;&softcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy; &ncy;&acy;&vcy;&scy;&iecy;&gcy;&dcy;&acy;</span></dt> <dd> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git commit ...
<span class="hljs-variable">$ </span>git reset --hard <span class="hljs-variable constant_">HEAD</span>~<span class="hljs-number">3</span>   (<span class="hljs-number">1</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="c7598c63b9aa68b21299cd21489955f24473d12d127acda748105c9212b4db31/a0" data-source="The last three commits (&lt;code&gt;HEAD&lt;/code&gt;, &lt;code&gt;HEAD^&lt;/code&gt;, and &lt;code&gt;HEAD~2&lt;/code&gt;) were bad and you do not want to ever see them again. Do &lt;strong&gt;not&lt;/strong&gt; do this if you have already given these commits to somebody else. (See the &amp;quot;RECOVERING FROM UPSTREAM REBASE&amp;quot; section in &lt;a href=&quot;git-rebase&quot;&gt;git-rebase[1]&lt;/a&gt; for the implications of doing so.)" onmousemove="i18n(this)">&Pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&icy;&iecy; &tcy;&rcy;&icy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&acy; ( <code>HEAD</code> ,  <code>HEAD^</code>  &icy;  <code>HEAD~2</code> ) &bcy;&ycy;&lcy;&icy; &pcy;&lcy;&ocy;&khcy;&icy;&mcy;&icy;, &icy; &vcy;&ycy; &ncy;&iecy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy; &vcy;&icy;&dcy;&iecy;&tcy;&softcy; &icy;&khcy; &scy;&ncy;&ocy;&vcy;&acy;. &Ncy;&iecy; &dcy;&iecy;&lcy;&acy;&jcy;&tcy;&iecy; &ecy;&tcy;&ocy;&gcy;&ocy;, &iecy;&scy;&lcy;&icy; &vcy;&ycy; &ucy;&zhcy;&iecy; &pcy;&iecy;&rcy;&iecy;&dcy;&acy;&lcy;&icy; &ecy;&tcy;&icy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ycy; &kcy;&ocy;&mcy;&ucy;-&tcy;&ocy; &dcy;&rcy;&ucy;&gcy;&ocy;&mcy;&ucy;. (&Scy;&mcy;. &rcy;&acy;&zcy;&dcy;&iecy;&lcy;  &quot;RECOVERING FROM UPSTREAM REBASE&quot;  &vcy;  <a href="git-rebase.html">git-rebase[1]</a> , &chcy;&tcy;&ocy;&bcy;&ycy; &ucy;&zcy;&ncy;&acy;&tcy;&softcy; &ocy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&scy;&tcy;&vcy;&icy;&yacy;&khcy; &ecy;&tcy;&ocy;&gcy;&ocy;.)</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Undoamergeorpull"><span data-i18n="b9da83663c56e04ec3bcc41a0ad0af26290cf1dc739d2264b0ed7890bce28b2a/fd" data-source="Undo a merge or pull" onmousemove="i18n(this)">&Ocy;&tcy;&mcy;&iecy;&ncy;&icy;&tcy;&softcy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&iecy; &icy;&lcy;&icy; &icy;&zcy;&vcy;&lcy;&iecy;&chcy;&iecy;&ncy;&icy;&iecy;</span></dt> <dd> <div> <div> <pre class="hljs language-sql">$ git pull                         (<span class="hljs-number">1</span>)
Auto<span class="hljs-operator">-</span>merging nitfol
CONFLICT (content): <span class="hljs-keyword">Merge</span> conflict <span class="hljs-keyword">in</span> nitfol
Automatic <span class="hljs-keyword">merge</span> failed; fix conflicts <span class="hljs-keyword">and</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">commit</span> the result.
$ git reset <span class="hljs-comment" title="--hard                 (2)">--&zhcy;&iecy;&scy;&tcy;&kcy;&icy;&jcy; (2)</span>
$ git pull . topic<span class="hljs-operator">/</span>branch          (<span class="hljs-number">3</span>)
Updating <span class="hljs-keyword">from</span> <span class="hljs-number">41223.</span>.. <span class="hljs-keyword">to</span> <span class="hljs-number">13134.</span>..
Fast<span class="hljs-operator">-</span>forward
$ git reset <span class="hljs-comment" title="--hard ORIG_HEAD       (4)">--hard ORIG_HEAD (4)</span></pre> </div> </div> <div> <ol> <li> <p><span data-i18n="6bde9d0be7fb11a066b787da284bf7acd668ac0d54cf2b41c5c9a11e0a62d196/bb" data-source="Try to update from the upstream resulted in a lot of conflicts; you were not ready to spend a lot of time merging right now, so you decide to do that later." onmousemove="i18n(this)">&Pcy;&ocy;&pcy;&ycy;&tcy;&kcy;&acy; &ocy;&bcy;&ncy;&ocy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy; &icy;&zcy; &acy;&pcy;&scy;&tcy;&rcy;&icy;&mcy;&acy; &pcy;&rcy;&icy;&vcy;&iecy;&lcy;&acy; &kcy; &mcy;&ncy;&ocy;&zhcy;&iecy;&scy;&tcy;&vcy;&ucy; &kcy;&ocy;&ncy;&fcy;&lcy;&icy;&kcy;&tcy;&ocy;&vcy;; &vcy;&ycy; &ncy;&iecy; &gcy;&ocy;&tcy;&ocy;&vcy;&ycy; &tcy;&rcy;&acy;&tcy;&icy;&tcy;&softcy; &mcy;&ncy;&ocy;&gcy;&ocy; &vcy;&rcy;&iecy;&mcy;&iecy;&ncy;&icy; &ncy;&acy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&iecy; &pcy;&rcy;&yacy;&mcy;&ocy; &scy;&iecy;&jcy;&chcy;&acy;&scy;, &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &rcy;&iecy;&shcy;&acy;&iecy;&tcy;&iecy; &scy;&dcy;&iecy;&lcy;&acy;&tcy;&softcy; &ecy;&tcy;&ocy; &pcy;&ocy;&zcy;&zhcy;&iecy;.</span></p> </li> <li> <p><span data-i18n="faed54ba061696b8fc514b32581e18e931e19f5c7829b3c1d84e8f98f103f053/3c" data-source="&amp;quot;pull&amp;quot; has not made merge commit, so &lt;code&gt;git reset --hard&lt;/code&gt; which is a synonym for &lt;code&gt;git reset --hard HEAD&lt;/code&gt; clears the mess from the index file and the working tree." onmousemove="i18n(this)">&quot;pull&quot;  &ncy;&iecy; &vcy;&ycy;&pcy;&ocy;&lcy;&ncy;&icy;&lcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy;, &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy;  <code>git reset --hard</code> , &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &scy;&icy;&ncy;&ocy;&ncy;&icy;&mcy;&ocy;&mcy;  <code>git reset --hard HEAD</code> , &ucy;&dcy;&acy;&lcy;&yacy;&iecy;&tcy; &bcy;&iecy;&scy;&pcy;&ocy;&rcy;&yacy;&dcy;&ocy;&kcy; &icy;&zcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ocy;&gcy;&ocy; &fcy;&acy;&jcy;&lcy;&acy; &icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&gcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;.</span></p> </li> <li> <p><span data-i18n="429051964adaa58520c6a2f09418fa7c710182313d5503c9bc99d3a8e4ce8126/c6" data-source="Merge a topic branch into the current branch, which resulted in a fast-forward." onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&dcy;&icy;&ncy;&icy;&tcy;&iecy; &vcy;&iecy;&tcy;&kcy;&ucy; &tcy;&iecy;&mcy;&ycy; &scy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy; &vcy;&iecy;&tcy;&kcy;&ocy;&jcy;, &chcy;&tcy;&ocy; &pcy;&rcy;&icy;&vcy;&iecy;&lcy;&ocy; &kcy; &pcy;&iecy;&rcy;&iecy;&mcy;&ocy;&tcy;&kcy;&iecy; &vcy;&pcy;&iecy;&rcy;&iecy;&dcy;.</span></p> </li> <li> <p><span data-i18n="c63179ee1d7505e862e286ea738c33cad280d312d9731e65cc30fee85563fd14/61" data-source="But you decided that the topic branch is not ready for public consumption yet. &amp;quot;pull&amp;quot; or &amp;quot;merge&amp;quot; always leaves the original tip of the current branch in &lt;code&gt;ORIG_HEAD&lt;/code&gt;, so resetting hard to it brings your index file and the working tree back to that state, and resets the tip of the branch to that commit." onmousemove="i18n(this)">&Ncy;&ocy; &vcy;&ycy; &rcy;&iecy;&shcy;&icy;&lcy;&icy;, &chcy;&tcy;&ocy; &vcy;&iecy;&tcy;&kcy;&acy; &tcy;&iecy;&mcy;&ycy; &iecy;&shchcy;&iecy; &ncy;&iecy; &gcy;&ocy;&tcy;&ocy;&vcy;&acy; &kcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&ncy;&icy;&yucy;  public .  &quot;pull&quot;  &icy;&lcy;&icy;  &quot;merge&quot;  &vcy;&scy;&iecy;&gcy;&dcy;&acy; &ocy;&scy;&tcy;&acy;&vcy;&lcy;&yacy;&iecy;&tcy; &icy;&scy;&khcy;&ocy;&dcy;&ncy;&ucy;&yucy; &vcy;&iecy;&rcy;&shcy;&icy;&ncy;&ucy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy; &vcy;&iecy;&tcy;&kcy;&icy; &vcy;  <code>ORIG_HEAD</code>  , &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &zhcy;&iecy;&scy;&tcy;&kcy;&icy;&jcy; &scy;&bcy;&rcy;&ocy;&scy; &vcy;&ocy;&zcy;&vcy;&rcy;&acy;&shchcy;&acy;&iecy;&tcy; &vcy;&acy;&shcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy; &icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &ocy;&bcy;&rcy;&acy;&tcy;&ncy;&ocy; &vcy; &ecy;&tcy;&ocy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy; &icy; &scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &vcy;&iecy;&rcy;&shcy;&icy;&ncy;&ucy; &vcy;&iecy;&tcy;&kcy;&icy; &dcy;&ocy; &ecy;&tcy;&ocy;&jcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;.</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Undoamergeorpullinsideadirtyworkingtree"><span data-i18n="2c3ca520ce5bf0ada05056e79a941240fccb9afdeaaa088407f487eec57ddae7/64" data-source="Undo a merge or pull inside a dirty working tree" onmousemove="i18n(this)">&Ocy;&tcy;&mcy;&iecy;&ncy;&icy;&tcy;&softcy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&iecy; &icy;&lcy;&icy; &vcy;&tcy;&yacy;&ncy;&ucy;&tcy;&softcy; &vcy;&ncy;&ucy;&tcy;&rcy;&softcy; &gcy;&rcy;&yacy;&zcy;&ncy;&ocy;&gcy;&ocy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&gcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;</span></dt> <dd> <div> <div> <pre class="hljs language-sql">$ git pull                         (<span class="hljs-number">1</span>)
Auto<span class="hljs-operator">-</span>merging nitfol
<span class="hljs-keyword">Merge</span> made <span class="hljs-keyword">by</span> recursive.
 nitfol                <span class="hljs-operator">|</span>   <span class="hljs-number">20</span> <span class="hljs-operator">+</span><span class="hljs-operator">+</span><span class="hljs-operator">+</span><span class="hljs-operator">+</span><span class="hljs-operator">+</span><span class="hljs-comment">----</span>
 ...
$ git reset <span class="hljs-comment" title="--merge ORIG_HEAD      (2)">--&ocy;&bcy;&hardcy;&iecy;&dcy;&icy;&ncy;&icy;&tcy;&softcy; ORIG_HEAD (2)</span></pre> </div> </div> <div> <ol> <li> <p><span data-i18n="e75a4c71ce4a3e2322d03b9f40df574fed1e3ba516014b74a0d9b40e7a572f96/e3" data-source="Even if you may have local modifications in your working tree, you can safely say &lt;code&gt;git pull&lt;/code&gt; when you know that the change in the other branch does not overlap with them." onmousemove="i18n(this)">&Dcy;&acy;&zhcy;&iecy; &iecy;&scy;&lcy;&icy; &ucy; &vcy;&acy;&scy; &mcy;&ocy;&gcy;&ucy;&tcy; &bcy;&ycy;&tcy;&softcy; &lcy;&ocy;&kcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &vcy;&acy;&shcy;&iecy;&mcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &scy;&mcy;&iecy;&lcy;&ocy; &gcy;&ocy;&vcy;&ocy;&rcy;&icy;&tcy;&softcy;  <code>git pull</code> , &kcy;&ocy;&gcy;&dcy;&acy; &zcy;&ncy;&acy;&iecy;&tcy;&iecy;, &chcy;&tcy;&ocy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&iecy; &vcy; &dcy;&rcy;&ucy;&gcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&iecy; &ncy;&iecy; &pcy;&iecy;&rcy;&iecy;&scy;&iecy;&kcy;&acy;&iecy;&tcy;&scy;&yacy; &scy; &ncy;&icy;&mcy;&icy;.</span></p> </li> <li> <p><span data-i18n="eee4f26a67e8be3fd31e697a07497cfcc346840f22972a84d30568fd910dfc6b/7f" data-source="After inspecting the result of the merge, you may find that the change in the other branch is unsatisfactory. Running &lt;code&gt;git reset --hard ORIG_HEAD&lt;/code&gt; will let you go back to where you were, but it will discard your local changes, which you do not want. &lt;code&gt;git reset --merge&lt;/code&gt; keeps your local changes." onmousemove="i18n(this)">&Pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&icy;&vcy; &rcy;&iecy;&zcy;&ucy;&lcy;&softcy;&tcy;&acy;&tcy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy;, &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &ocy;&bcy;&ncy;&acy;&rcy;&ucy;&zhcy;&icy;&tcy;&softcy;, &chcy;&tcy;&ocy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&iecy; &vcy; &dcy;&rcy;&ucy;&gcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&iecy; &ncy;&iecy;&ucy;&dcy;&ocy;&vcy;&lcy;&iecy;&tcy;&vcy;&ocy;&rcy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy;. &Zcy;&acy;&pcy;&ucy;&scy;&kcy;  <code>git reset --hard ORIG_HEAD</code>  &pcy;&ocy;&zcy;&vcy;&ocy;&lcy;&icy;&tcy; &vcy;&acy;&mcy; &vcy;&iecy;&rcy;&ncy;&ucy;&tcy;&softcy;&scy;&yacy; &tcy;&ucy;&dcy;&acy;, &gcy;&dcy;&iecy; &vcy;&ycy; &bcy;&ycy;&lcy;&icy;, &ncy;&ocy; &ocy;&tcy;&mcy;&iecy;&ncy;&icy;&tcy; &vcy;&acy;&shcy;&icy; &lcy;&ocy;&kcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &vcy;&acy;&mcy; &ncy;&iecy; &ncy;&ucy;&zhcy;&ncy;&ycy;.  <code>git reset --merge</code>  &scy;&ocy;&khcy;&rcy;&acy;&ncy;&yacy;&iecy;&tcy; &vcy;&acy;&shcy;&icy; &lcy;&ocy;&kcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;.</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Interruptedworkflow"><span data-i18n="0ad33717a4543d8435e7cb38c7bdc618f37c8c909b71c6aca6d10bb91ef31863/22" data-source="Interrupted workflow" onmousemove="i18n(this)">Interrupted workflow</span></dt> <dd> <p><span data-i18n="86d608a2be13f65622e68ff8ee4f1c90fb83bb21e704f77b388d3aee8bb7f296/22" data-source="Suppose you are interrupted by an urgent fix request while you are in the middle of a large change. The files in your working tree are not in any shape to be committed yet, but you need to get to the other branch for a quick bugfix." onmousemove="i18n(this)">&Pcy;&rcy;&iecy;&dcy;&pcy;&ocy;&lcy;&ocy;&zhcy;&icy;&mcy;, &vcy;&acy;&scy; &pcy;&rcy;&iecy;&rcy;&vcy;&acy;&lcy; &zcy;&acy;&pcy;&rcy;&ocy;&scy; &ncy;&acy; &scy;&rcy;&ocy;&chcy;&ncy;&ocy;&iecy; &icy;&scy;&pcy;&rcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy;, &kcy;&ocy;&gcy;&dcy;&acy; &vcy;&ycy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&tcy;&iecy;&scy;&softcy; &vcy; &pcy;&rcy;&ocy;&tscy;&iecy;&scy;&scy;&iecy; &bcy;&ocy;&lcy;&softcy;&shcy;&ocy;&gcy;&ocy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;. &Fcy;&acy;&jcy;&lcy;&ycy; &vcy; &vcy;&acy;&shcy;&iecy;&mcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy; &iecy;&shchcy;&iecy; &ncy;&iecy; &gcy;&ocy;&tcy;&ocy;&vcy;&ycy; &kcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &ncy;&ocy; &vcy;&acy;&mcy; &ncy;&ucy;&zhcy;&ncy;&ocy; &pcy;&iecy;&rcy;&iecy;&jcy;&tcy;&icy; &vcy; &dcy;&rcy;&ucy;&gcy;&ucy;&yucy; &vcy;&iecy;&tcy;&kcy;&ucy; &dcy;&lcy;&yacy; &bcy;&ycy;&scy;&tcy;&rcy;&ocy;&gcy;&ocy; &icy;&scy;&pcy;&rcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy; &ocy;&shcy;&icy;&bcy;&kcy;&icy;.</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git switch feature  ;<span class="hljs-comment" title="# you were working in &quot;feature&quot; branch and"># &vcy;&ycy; &rcy;&acy;&bcy;&ocy;&tcy;&acy;&lcy;&icy; &vcy; &vcy;&iecy;&tcy;&kcy;&iecy;  &quot;feature&quot;  &icy;</span>
<span class="hljs-variable">$ </span>work work work      ;<span class="hljs-comment" title="# got interrupted"># &mcy;&iecy;&ncy;&yacy; &pcy;&rcy;&iecy;&rcy;&vcy;&acy;&lcy;&icy;</span>
<span class="hljs-variable">$ </span>git commit -a -m <span class="hljs-string">&quot;snapshot WIP&quot;</span>                 (<span class="hljs-number">1</span>)
<span class="hljs-variable">$ </span>git switch master
<span class="hljs-variable">$ </span>fix fix fix
<span class="hljs-variable">$ </span>git commit ;<span class="hljs-comment" title="# commit with real log"># &fcy;&icy;&kcy;&scy;&icy;&rcy;&ucy;&iecy;&mcy; &scy; &rcy;&iecy;&acy;&lcy;&softcy;&ncy;&ycy;&mcy; &zhcy;&ucy;&rcy;&ncy;&acy;&lcy;&ocy;&mcy;</span>
<span class="hljs-variable">$ </span>git switch feature
<span class="hljs-variable">$ </span>git reset --soft <span class="hljs-variable constant_">HEAD</span>^ ;<span class="hljs-comment" title="# go back to WIP state  (2)"># &vcy;&iecy;&rcy;&ncy;&ucy;&tcy;&softcy;&scy;&yacy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy; WIP (2)</span>
<span class="hljs-variable">$ </span>git reset                                       (<span class="hljs-number">3</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="9f9289c56a0fb18caee0b5eacb98668efc996dac4a158b21e692a4a20f157c47/c0" data-source="This commit will get blown away so a throw-away log message is OK." onmousemove="i18n(this)">&Ecy;&tcy;&ocy;&tcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy; &bcy;&ucy;&dcy;&iecy;&tcy; &ucy;&ncy;&icy;&chcy;&tcy;&ocy;&zhcy;&iecy;&ncy;, &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &vcy;&ycy;&bcy;&rcy;&ocy;&shcy;&iecy;&ncy;&ncy;&ocy;&iecy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&iecy; &zhcy;&ucy;&rcy;&ncy;&acy;&lcy;&acy; &mdash; &ecy;&tcy;&ocy; &ncy;&ocy;&rcy;&mcy;&acy;&lcy;&softcy;&ncy;&ocy;.</span></p> </li> <li> <p><span data-i18n="3dbf274382f18907a10564b94e53cef9cdbffbf4756300833d8f33945f998c9d/ed" data-source="This removes the &lt;code&gt;WIP&lt;/code&gt; commit from the commit history, and sets your working tree to the state just before you made that snapshot." onmousemove="i18n(this)">&Ecy;&tcy;&ocy; &ucy;&dcy;&acy;&lcy;&icy;&tcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;  <code>WIP</code>  &icy;&zcy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&icy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &icy; &ucy;&scy;&tcy;&acy;&ncy;&ocy;&vcy;&icy;&tcy; &vcy;&acy;&shcy;&iecy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy; &ncy;&iecy;&pcy;&ocy;&scy;&rcy;&iecy;&dcy;&scy;&tcy;&vcy;&iecy;&ncy;&ncy;&ocy; &pcy;&iecy;&rcy;&iecy;&dcy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&iecy;&mcy; &ecy;&tcy;&ocy;&gcy;&ocy; &mcy;&ocy;&mcy;&iecy;&ncy;&tcy;&acy;&lcy;&softcy;&ncy;&ocy;&gcy;&ocy; &scy;&ncy;&icy;&mcy;&kcy;&acy;.</span></p> </li> <li> <p><span data-i18n="7e5512450885174979205573bf5ca7fa7f5a53cb7e74ce6224729748d30b83cc/63" data-source="At this point the index file still has all the WIP changes you committed as &lt;code&gt;snapshot WIP&lt;/code&gt;. This updates the index to show your WIP files as uncommitted." onmousemove="i18n(this)">&Ncy;&acy; &ecy;&tcy;&ocy;&mcy; &ecy;&tcy;&acy;&pcy;&iecy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy; &vcy;&scy;&iecy; &iecy;&shchcy;&iecy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&tcy; &vcy;&scy;&iecy; &ncy;&iecy;&zcy;&acy;&vcy;&iecy;&rcy;&shcy;&iecy;&ncy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &vcy;&ycy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&lcy;&icy; &kcy;&acy;&kcy;  <code>snapshot WIP</code> . &Ecy;&tcy;&ocy; &ocy;&bcy;&ncy;&ocy;&vcy;&icy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;, &chcy;&tcy;&ocy;&bcy;&ycy; &vcy;&acy;&shcy;&icy; &fcy;&acy;&jcy;&lcy;&ycy; WIP &ocy;&tcy;&ocy;&bcy;&rcy;&acy;&zhcy;&acy;&lcy;&icy;&scy;&softcy; &kcy;&acy;&kcy; &ncy;&iecy;&zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ycy;&iecy;.</span></p> </li> </ol> </div> <p><span data-i18n="f818dcd232b608a95a2c62262767fb844159ade6bf60662de49d2f2294243e27/6b" data-source="See also &lt;a href=&quot;git-stash&quot;&gt;git-stash[1]&lt;/a&gt;." onmousemove="i18n(this)">&Scy;&mcy;. &tcy;&acy;&kcy;&zhcy;&iecy;  <a href="git-stash.html">git-stash[1]</a> .</span></p> </dd> <dt id="Documentation/git-reset.txt-Resetasinglefileintheindex"><span data-i18n="ff7eb9e77e57261e6acbf2e8e780cc105e75da3665995c587916c1f16d30bb51/84" data-source="Reset a single file in the index" onmousemove="i18n(this)">&Scy;&bcy;&rcy;&ocy;&scy;&icy;&tcy;&softcy; &ocy;&dcy;&icy;&ncy; &fcy;&acy;&jcy;&lcy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&iecy;</span></dt> <dd> <p><span data-i18n="440e815e30858ae7323cc1411d452e77d5798ee5330c2c3d31c2a09f1ef9ce6f/3a" data-source="Suppose you have added a file to your index, but later decide you do not want to add it to your commit. You can remove the file from the index while keeping your changes with git reset." onmousemove="i18n(this)">&Pcy;&rcy;&iecy;&dcy;&pcy;&ocy;&lcy;&ocy;&zhcy;&icy;&mcy;, &vcy;&ycy; &dcy;&ocy;&bcy;&acy;&vcy;&icy;&lcy;&icy; &fcy;&acy;&jcy;&lcy; &vcy; &scy;&vcy;&ocy;&jcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;, &ncy;&ocy; &pcy;&ocy;&zcy;&zhcy;&iecy; &rcy;&iecy;&shcy;&icy;&lcy;&icy;, &chcy;&tcy;&ocy; &ncy;&iecy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&yacy;&tcy;&softcy; &iecy;&gcy;&ocy; &vcy; &scy;&vcy;&ocy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;. &Vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &ucy;&dcy;&acy;&lcy;&icy;&tcy;&softcy; &fcy;&acy;&jcy;&lcy; &icy;&zcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy;, &scy;&ocy;&khcy;&rcy;&acy;&ncy;&icy;&vcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &vcy;&ycy;&pcy;&ocy;&lcy;&ncy;&icy;&vcy; &scy;&bcy;&rcy;&ocy;&scy;  git .</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git reset -- frotz.c                      (<span class="hljs-number">1</span>)
<span class="hljs-variable">$ </span>git commit -m <span class="hljs-string">&quot;Commit files in index&quot;</span>     (<span class="hljs-number">2</span>)
<span class="hljs-variable">$ </span>git add frotz.c                           (<span class="hljs-number">3</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="2d0f6eb8dd3e71696e1d6e69a2fbd79dbc4580eea6e539c9e19fce738d62b96d/42" data-source="This removes the file from the index while keeping it in the working directory." onmousemove="i18n(this)">&Ecy;&tcy;&ocy; &ucy;&dcy;&acy;&lcy;&icy;&tcy; &fcy;&acy;&jcy;&lcy; &icy;&zcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&acy;, &scy;&ocy;&khcy;&rcy;&acy;&ncy;&icy;&vcy; &iecy;&gcy;&ocy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&iecy;.</span></p> </li> <li> <p><span data-i18n="6cb693a8c053fad35a52cff3198008adcb25808b1f6e2a25c8c81a63043760b4/c1" data-source="This commits all other changes in the index." onmousemove="i18n(this)">&Ecy;&tcy;&ocy; &fcy;&icy;&kcy;&scy;&icy;&rcy;&ucy;&iecy;&tcy; &vcy;&scy;&iecy; &ocy;&scy;&tcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&iecy;.</span></p> </li> <li> <p><span data-i18n="d2eecbb51c1fc9890861e3ea35e01ccde3f08d5543c3945406568f494dd1744d/18" data-source="Adds the file to the index again." onmousemove="i18n(this)">&Scy;&ncy;&ocy;&vcy;&acy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&yacy;&iecy;&tcy; &fcy;&acy;&jcy;&lcy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;.</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Keepchangesinworkingtreewhilediscardingsomepreviouscommits"><span data-i18n="ff0f72ff4f23b57553ffe20d0be6c5f733fa15b100072e5107be47c94a431334/3f" data-source="Keep changes in working tree while discarding some previous commits" onmousemove="i18n(this)">&Scy;&ocy;&khcy;&rcy;&acy;&ncy;&yacy;&jcy;&tcy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &ocy;&tcy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&yacy; &pcy;&rcy;&icy; &ecy;&tcy;&ocy;&mcy; &ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &pcy;&rcy;&iecy;&dcy;&ycy;&dcy;&ucy;&shchcy;&icy;&iecy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ycy;.</span></dt> <dd> <p><span data-i18n="7959d0694cf097503228f5116998217dc823948fbf242d0ce20d6c87f9e33864/99" data-source="Suppose you are working on something and you commit it, and then you continue working a bit more, but now you think that what you have in your working tree should be in another branch that has nothing to do with what you committed previously. You can start a new branch and reset it while keeping the changes in your working tree." onmousemove="i18n(this)">&Pcy;&rcy;&iecy;&dcy;&pcy;&ocy;&lcy;&ocy;&zhcy;&icy;&mcy;, &vcy;&ycy; &rcy;&acy;&bcy;&ocy;&tcy;&acy;&iecy;&tcy;&iecy; &ncy;&acy;&dcy; &chcy;&iecy;&mcy;-&tcy;&ocy; &icy; &fcy;&icy;&kcy;&scy;&icy;&rcy;&ucy;&iecy;&tcy;&iecy; &ecy;&tcy;&ocy;, &acy; &zcy;&acy;&tcy;&iecy;&mcy; &pcy;&rcy;&ocy;&dcy;&ocy;&lcy;&zhcy;&acy;&iecy;&tcy;&iecy; &rcy;&acy;&bcy;&ocy;&tcy;&acy;&tcy;&softcy; &iecy;&shchcy;&iecy; &ncy;&iecy;&mcy;&ncy;&ocy;&gcy;&ocy;, &ncy;&ocy; &tcy;&iecy;&pcy;&iecy;&rcy;&softcy; &dcy;&ucy;&mcy;&acy;&iecy;&tcy;&iecy;, &chcy;&tcy;&ocy; &tcy;&ocy;, &chcy;&tcy;&ocy; &ucy; &vcy;&acy;&scy; &iecy;&scy;&tcy;&softcy; &vcy; &vcy;&acy;&shcy;&iecy;&mcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &dcy;&ocy;&lcy;&zhcy;&ncy;&ocy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&tcy;&softcy;&scy;&yacy; &vcy; &dcy;&rcy;&ucy;&gcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&acy;&yacy; &ncy;&iecy; &icy;&mcy;&iecy;&iecy;&tcy; &ncy;&icy;&chcy;&iecy;&gcy;&ocy; &ocy;&bcy;&shchcy;&iecy;&gcy;&ocy; &scy; &tcy;&iecy;&mcy;, &chcy;&tcy;&ocy; &vcy;&ycy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&lcy;&icy; &rcy;&acy;&ncy;&iecy;&iecy;. &Vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &zcy;&acy;&pcy;&ucy;&scy;&tcy;&icy;&tcy;&softcy; &ncy;&ocy;&vcy;&ucy;&yucy; &vcy;&iecy;&tcy;&kcy;&ucy; &icy; &scy;&bcy;&rcy;&ocy;&scy;&icy;&tcy;&softcy; &iecy;&iecy;, &scy;&ocy;&khcy;&rcy;&acy;&ncy;&icy;&vcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;.</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git tag start
<span class="hljs-variable">$ </span>git switch -c branch1
<span class="hljs-variable">$ </span>edit
<span class="hljs-variable">$ </span>git commit ...                            (<span class="hljs-number">1</span>)
<span class="hljs-variable">$ </span>edit
<span class="hljs-variable">$ </span>git switch -c branch2                     (<span class="hljs-number">2</span>)
<span class="hljs-variable">$ </span>git reset --keep start                    (<span class="hljs-number">3</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="0c12998e0dc87a015241a3046d20e62d8e140b8d7463cee7700856538d59b183/02" data-source="This commits your first edits in &lt;code&gt;branch1&lt;/code&gt;." onmousemove="i18n(this)">&Ecy;&tcy;&ocy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ucy;&iecy;&tcy; &vcy;&acy;&shcy;&icy; &pcy;&iecy;&rcy;&vcy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy;  <code>branch1</code> .</span></p> </li> <li> <p><span data-i18n="2251e74039ed00f712eb3180776035862276cdd8ef63bb8a6617edb8bf506d92/19" data-source="In the ideal world, you could have realized that the earlier commit did not belong to the new topic when you created and switched to &lt;code&gt;branch2&lt;/code&gt; (i.e. &lt;code&gt;git switch -c branch2 start&lt;/code&gt;), but nobody is perfect." onmousemove="i18n(this)">&Vcy; &icy;&dcy;&iecy;&acy;&lcy;&softcy;&ncy;&ocy;&mcy; &mcy;&icy;&rcy;&iecy; &vcy;&ycy; &mcy;&ocy;&gcy;&lcy;&icy; &bcy;&ycy; &pcy;&ocy;&ncy;&yacy;&tcy;&softcy;, &chcy;&tcy;&ocy; &pcy;&rcy;&iecy;&dcy;&ycy;&dcy;&ucy;&shchcy;&icy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy; &ncy;&iecy; &pcy;&rcy;&icy;&ncy;&acy;&dcy;&lcy;&iecy;&zhcy;&acy;&lcy; &kcy; &ncy;&ocy;&vcy;&ocy;&jcy; &tcy;&iecy;&mcy;&iecy;, &kcy;&ocy;&gcy;&dcy;&acy; &vcy;&ycy; &scy;&ocy;&zcy;&dcy;&acy;&lcy;&icy; &icy; &pcy;&iecy;&rcy;&iecy;&kcy;&lcy;&yucy;&chcy;&icy;&lcy;&icy;&scy;&softcy; &ncy;&acy;  <code>branch2</code>  (&tcy;. &iecy;.  <code>git switch -c branch2 start</code> ), &ncy;&ocy; &ncy;&icy;&kcy;&tcy;&ocy; &ncy;&iecy; &icy;&dcy;&iecy;&acy;&lcy;&iecy;&ncy;.</span></p> </li> <li> <p><span data-i18n="05ab382d2ea9aa15423f6ebbc2fdc7affde54e921899dc3e303c11c359020e5e/8d" data-source="But you can use &lt;code&gt;reset --keep&lt;/code&gt; to remove the unwanted commit after you switched to &lt;code&gt;branch2&lt;/code&gt;." onmousemove="i18n(this)">&Ncy;&ocy; &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy;  <code>reset --keep</code>  &dcy;&lcy;&yacy; &ucy;&dcy;&acy;&lcy;&iecy;&ncy;&icy;&yacy; &ncy;&iecy;&zhcy;&iecy;&lcy;&acy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy;&jcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &pcy;&ocy;&scy;&lcy;&iecy; &pcy;&iecy;&rcy;&iecy;&khcy;&ocy;&dcy;&acy; &ncy;&acy;  <code>branch2</code> .</span></p> </li> </ol> </div> </dd> <dt id="Documentation/git-reset.txt-Splitacommitapartintoasequenceofcommits"><span data-i18n="62b4be2f3d45e135772dc4f40eecd6eea1b8e9b0646e5002ed4668474bcda228/87" data-source="Split a commit apart into a sequence of commits" onmousemove="i18n(this)">&Rcy;&acy;&zcy;&dcy;&iecy;&lcy;&icy;&tcy;&softcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy; &ncy;&acy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ocy;&vcy;&acy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy;&scy;&tcy;&softcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;</span></dt> <dd> <p><span data-i18n="d5f670c5d9b422d0e5e92a81faf4a309de32302ab131674c9a23e421995e6476/6c" data-source="Suppose that you have created lots of logically separate changes and committed them together. Then, later you decide that it might be better to have each logical chunk associated with its own commit. You can use git reset to rewind history without changing the contents of your local files, and then successively use &lt;code&gt;git add -p&lt;/code&gt; to interactively select which hunks to include into each commit, using &lt;code&gt;git commit -c&lt;/code&gt; to pre-populate the commit message." onmousemove="i18n(this)">&Pcy;&rcy;&iecy;&dcy;&pcy;&ocy;&lcy;&ocy;&zhcy;&icy;&mcy;, &vcy;&ycy; &scy;&ocy;&zcy;&dcy;&acy;&lcy;&icy; &mcy;&ncy;&ocy;&zhcy;&iecy;&scy;&tcy;&vcy;&ocy; &lcy;&ocy;&gcy;&icy;&chcy;&iecy;&scy;&kcy;&icy; &ocy;&tcy;&dcy;&iecy;&lcy;&softcy;&ncy;&ycy;&khcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&jcy; &icy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&lcy;&icy; &icy;&khcy; &vcy;&mcy;&iecy;&scy;&tcy;&iecy;. &Zcy;&acy;&tcy;&iecy;&mcy; &pcy;&ocy;&zcy;&zhcy;&iecy; &vcy;&ycy; &rcy;&iecy;&shcy;&acy;&iecy;&tcy;&iecy;, &chcy;&tcy;&ocy;, &vcy;&ocy;&zcy;&mcy;&ocy;&zhcy;&ncy;&ocy;, &bcy;&ycy;&lcy;&ocy; &bcy;&ycy; &lcy;&ucy;&chcy;&shcy;&iecy;, &chcy;&tcy;&ocy;&bcy;&ycy; &kcy;&acy;&zhcy;&dcy;&ycy;&jcy; &lcy;&ocy;&gcy;&icy;&chcy;&iecy;&scy;&kcy;&icy;&jcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy; &bcy;&ycy;&lcy; &scy;&vcy;&yacy;&zcy;&acy;&ncy; &scy; &ocy;&tcy;&dcy;&iecy;&lcy;&softcy;&ncy;&ycy;&mcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&mcy;. &Vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy; &scy;&bcy;&rcy;&ocy;&scy;  git , &chcy;&tcy;&ocy;&bcy;&ycy; &pcy;&iecy;&rcy;&iecy;&mcy;&ocy;&tcy;&acy;&tcy;&softcy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&yucy; &bcy;&iecy;&zcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&gcy;&ocy; &vcy;&acy;&shcy;&icy;&khcy; &lcy;&ocy;&kcy;&acy;&lcy;&softcy;&ncy;&ycy;&khcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy;, &acy; &zcy;&acy;&tcy;&iecy;&mcy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ocy;&vcy;&acy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy;  <code>git add -p</code>  &dcy;&lcy;&yacy; &icy;&ncy;&tcy;&iecy;&rcy;&acy;&kcy;&tcy;&icy;&vcy;&ncy;&ocy;&gcy;&ocy; &vcy;&ycy;&bcy;&ocy;&rcy;&acy;, &kcy;&acy;&kcy;&icy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ycy; &vcy;&kcy;&lcy;&yucy;&chcy;&acy;&tcy;&softcy; &vcy; &kcy;&acy;&zhcy;&dcy;&ycy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yacy;  <code>git commit -c</code>  &dcy;&lcy;&yacy; &pcy;&rcy;&iecy;&dcy;&vcy;&acy;&rcy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy;&gcy;&ocy; &zcy;&acy;&pcy;&ocy;&lcy;&ncy;&iecy;&ncy;&icy;&yacy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&yacy; &ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&iecy;.</span></p> <div> <div> <pre class="hljs language-scss">$ git reset -N HEAD^                        (<span class="hljs-number">1</span>)
$ git add -<span class="hljs-selector-tag">p</span>                                (<span class="hljs-number">2</span>)
$ git diff <span class="hljs-attr">--cached</span>                         (<span class="hljs-number">3</span>)
$ git commit -c HEAD@{<span class="hljs-number">1</span>}                    (<span class="hljs-number">4</span>)
...                                         (<span class="hljs-number">5</span>)
$ git add ...                               (<span class="hljs-number">6</span>)
$ git diff <span class="hljs-attr">--cached</span>                         (<span class="hljs-number">7</span>)
$ git commit ...                            (<span class="hljs-number">8</span>)</pre> </div> </div> <div> <ol> <li> <p><span data-i18n="27e45f322a41743770c622acfffc0479c55c1aa0f3c1e97f207ddca8d08c92be/b3" data-source="First, reset the history back one commit so that we remove the original commit, but leave the working tree with all the changes. The -N ensures that any new files added with &lt;code&gt;HEAD&lt;/code&gt; are still marked so that &lt;code&gt;git add -p&lt;/code&gt; will find them." onmousemove="i18n(this)">&Scy;&ncy;&acy;&chcy;&acy;&lcy;&acy; &scy;&bcy;&rcy;&ocy;&scy;&icy;&mcy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&yucy; &ncy;&acy; &ocy;&dcy;&icy;&ncy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &chcy;&tcy;&ocy;&bcy;&ycy; &mcy;&ycy; &ucy;&dcy;&acy;&lcy;&icy;&lcy;&icy; &icy;&scy;&khcy;&ocy;&dcy;&ncy;&ycy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &ncy;&ocy; &ocy;&scy;&tcy;&acy;&vcy;&icy;&lcy;&icy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &scy;&ocy; &vcy;&scy;&iecy;&mcy;&icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;&mcy;&icy;. &Pcy;&acy;&rcy;&acy;&mcy;&iecy;&tcy;&rcy; -N &gcy;&acy;&rcy;&acy;&ncy;&tcy;&icy;&rcy;&ucy;&iecy;&tcy;, &chcy;&tcy;&ocy; &lcy;&yucy;&bcy;&ycy;&iecy; &ncy;&ocy;&vcy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&ycy;, &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&iecy;&ncy;&ncy;&ycy;&iecy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy;  <code>HEAD</code> , &pcy;&ocy;-&pcy;&rcy;&iecy;&zhcy;&ncy;&iecy;&mcy;&ucy; &bcy;&ucy;&dcy;&ucy;&tcy; &pcy;&ocy;&mcy;&iecy;&chcy;&iecy;&ncy;&ycy;, &chcy;&tcy;&ocy;&bcy;&ycy;  <code>git add -p</code>  &mcy;&ocy;&gcy; &icy;&khcy; &ncy;&acy;&jcy;&tcy;&icy;.</span></p> </li> <li> <p><span data-i18n="c4d3b99eda1de341849d15885aca0b889354383a5dd749b9144b8fa147cf5aa5/b7" data-source="Next, we interactively select diff hunks to add using the &lt;code&gt;git add -p&lt;/code&gt; facility. This will ask you about each diff hunk in sequence and you can use simple commands such as &amp;quot;yes, include this&amp;quot;, &amp;quot;No don&amp;rsquo;t include this&amp;quot; or even the very powerful &amp;quot;edit&amp;quot; facility." onmousemove="i18n(this)">&Zcy;&acy;&tcy;&iecy;&mcy; &mcy;&ycy; &vcy; &icy;&ncy;&tcy;&iecy;&rcy;&acy;&kcy;&tcy;&icy;&vcy;&ncy;&ocy;&mcy; &rcy;&iecy;&zhcy;&icy;&mcy;&iecy; &vcy;&ycy;&bcy;&icy;&rcy;&acy;&iecy;&mcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ycy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&icy;&jcy; &dcy;&lcy;&yacy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy; &scy;&rcy;&iecy;&dcy;&scy;&tcy;&vcy;&acy;  <code>git add -p</code> . &Pcy;&rcy;&icy; &ecy;&tcy;&ocy;&mcy; &vcy;&acy;&mcy; &bcy;&ucy;&dcy;&iecy;&tcy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ocy;&vcy;&acy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy; &zcy;&acy;&dcy;&acy;&vcy;&acy;&tcy;&softcy;&scy;&yacy; &vcy;&ocy;&pcy;&rcy;&ocy;&scy; &ocy; &kcy;&acy;&zhcy;&dcy;&ocy;&mcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&iecy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&icy;&jcy;, &icy; &vcy;&ycy; &scy;&mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy; &pcy;&rcy;&ocy;&scy;&tcy;&ycy;&iecy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;&ycy;, &tcy;&acy;&kcy;&icy;&iecy; &kcy;&acy;&kcy;  &quot;yes, include this&quot; ,  &quot;No don&rsquo;t include this&quot;  &icy;&lcy;&icy; &dcy;&acy;&zhcy;&iecy; &ocy;&chcy;&iecy;&ncy;&softcy; &mcy;&ocy;&shchcy;&ncy;&ucy;&yucy; &fcy;&ucy;&ncy;&kcy;&tscy;&icy;&yucy;  &quot;edit&quot; .</span></p> </li> <li> <p><span data-i18n="2e072433457f36d3824e530d1f9d6b8c45914e6671bd865b0a1b8a8bb9c953c0/b7" data-source="Once satisfied with the hunks you want to include, you should verify what has been prepared for the first commit by using &lt;code&gt;git diff --cached&lt;/code&gt;. This shows all the changes that have been moved into the index and are about to be committed." onmousemove="i18n(this)">&IEcy;&scy;&lcy;&icy; &vcy;&ycy; &ucy;&dcy;&ocy;&vcy;&lcy;&iecy;&tcy;&vcy;&ocy;&rcy;&iecy;&ncy;&ycy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;&mcy;&icy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy; &vcy;&kcy;&lcy;&yucy;&chcy;&icy;&tcy;&softcy;, &vcy;&acy;&mcy; &scy;&lcy;&iecy;&dcy;&ucy;&iecy;&tcy; &pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&icy;&tcy;&softcy;, &chcy;&tcy;&ocy; &bcy;&ycy;&lcy;&ocy; &pcy;&ocy;&dcy;&gcy;&ocy;&tcy;&ocy;&vcy;&lcy;&iecy;&ncy;&ocy; &dcy;&lcy;&yacy; &pcy;&iecy;&rcy;&vcy;&ocy;&gcy;&ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&acy;, &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy;  <code>git diff --cached</code> . &Zcy;&dcy;&iecy;&scy;&softcy; &pcy;&ocy;&kcy;&acy;&zcy;&acy;&ncy;&ycy; &vcy;&scy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &bcy;&ycy;&lcy;&icy; &pcy;&iecy;&rcy;&iecy;&ncy;&iecy;&scy;&iecy;&ncy;&ycy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &icy; &scy;&kcy;&ocy;&rcy;&ocy; &bcy;&ucy;&dcy;&ucy;&tcy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ycy;.</span></p> </li> <li> <p><span data-i18n="3b552092bf8e09f46928227b17730761ad47a9c1dda91253276bc86b6c972bcf/4f" data-source="Next, commit the changes stored in the index. The &lt;code&gt;-c&lt;/code&gt; option specifies to pre-populate the commit message from the original message that you started with in the first commit. This is helpful to avoid retyping it. The &lt;code&gt;HEAD@{1}&lt;/code&gt; is a special notation for the commit that &lt;code&gt;HEAD&lt;/code&gt; used to be at prior to the original reset commit (1 change ago). See &lt;a href=&quot;git-reflog&quot;&gt;git-reflog[1]&lt;/a&gt; for more details. You may also use any other valid commit reference." onmousemove="i18n(this)">&Zcy;&acy;&tcy;&iecy;&mcy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ucy;&jcy;&tcy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &khcy;&rcy;&acy;&ncy;&yacy;&shchcy;&icy;&iecy;&scy;&yacy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&iecy;. &Ocy;&pcy;&tscy;&icy;&yacy;  <code>-c</code>  &ucy;&kcy;&acy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy; &ncy;&acy; &pcy;&rcy;&iecy;&dcy;&vcy;&acy;&rcy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy;&iecy; &zcy;&acy;&pcy;&ocy;&lcy;&ncy;&iecy;&ncy;&icy;&iecy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&yacy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &icy;&zcy; &icy;&scy;&khcy;&ocy;&dcy;&ncy;&ocy;&gcy;&ocy; &scy;&ocy;&ocy;&bcy;&shchcy;&iecy;&ncy;&icy;&yacy;, &scy; &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&gcy;&ocy; &vcy;&ycy; &ncy;&acy;&chcy;&acy;&lcy;&icy; &pcy;&iecy;&rcy;&vcy;&ucy;&yucy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;. &Ecy;&tcy;&ocy; &pcy;&ocy;&lcy;&iecy;&zcy;&ncy;&ocy;, &chcy;&tcy;&ocy;&bcy;&ycy; &icy;&zcy;&bcy;&iecy;&zhcy;&acy;&tcy;&softcy; &pcy;&ocy;&vcy;&tcy;&ocy;&rcy;&ncy;&ocy;&gcy;&ocy; &vcy;&vcy;&ocy;&dcy;&acy;.  <code>HEAD@{1}</code>  &mdash; &ecy;&tcy;&ocy; &scy;&pcy;&iecy;&tscy;&icy;&acy;&lcy;&softcy;&ncy;&acy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&softcy; &dcy;&lcy;&yacy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &ncy;&acy; &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&jcy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&lcy;&scy;&yacy;  <code>HEAD</code>  &dcy;&ocy; &icy;&scy;&khcy;&ocy;&dcy;&ncy;&ocy;&jcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &scy;&bcy;&rcy;&ocy;&scy;&acy; (1 &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&iecy; &ncy;&acy;&zcy;&acy;&dcy;). &Dcy;&ocy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ucy;&yucy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&yucy; &scy;&mcy;. &vcy;  <a href="git-reflog.html">git-reflog[1]</a> . &Vcy;&ycy; &tcy;&acy;&kcy;&zhcy;&iecy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy; &lcy;&yucy;&bcy;&ucy;&yucy; &dcy;&rcy;&ucy;&gcy;&ucy;&yucy; &dcy;&iecy;&jcy;&scy;&tcy;&vcy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ucy;&yucy; &scy;&scy;&ycy;&lcy;&kcy;&ucy; &ncy;&acy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;.</span></p> </li> <li> <p><span data-i18n="afed1ff66fde5bd11e811d3d91cb4f78229275a7c663f7ec1c2955f13c3b99f3/1d" data-source="You can repeat steps 2-4 multiple times to break the original code into any number of commits." onmousemove="i18n(this)">&Vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &pcy;&ocy;&vcy;&tcy;&ocy;&rcy;&icy;&tcy;&softcy; &shcy;&acy;&gcy;&icy; 2&ndash;4 &ncy;&iecy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ocy; &rcy;&acy;&zcy;, &chcy;&tcy;&ocy;&bcy;&ycy; &rcy;&acy;&zcy;&bcy;&icy;&tcy;&softcy; &icy;&scy;&khcy;&ocy;&dcy;&ncy;&ycy;&jcy; &kcy;&ocy;&dcy; &ncy;&acy; &lcy;&yucy;&bcy;&ocy;&iecy; &kcy;&ocy;&lcy;&icy;&chcy;&iecy;&scy;&tcy;&vcy;&ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;.</span></p> </li> <li> <p><span data-i18n="6a3ba5e17daa57c729deb5aa837ad34737e8c33ccd15a7a665104bda9f6ab2d4/7a" data-source="Now you&amp;rsquo;ve split out many of the changes into their own commits, and might no longer use the patch mode of &lt;code&gt;git add&lt;/code&gt;, in order to select all remaining uncommitted changes." onmousemove="i18n(this)">&Tcy;&iecy;&pcy;&iecy;&rcy;&softcy; &vcy;&ycy; &rcy;&acy;&zcy;&dcy;&iecy;&lcy;&icy;&lcy;&icy; &mcy;&ncy;&ocy;&gcy;&icy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &ncy;&acy; &ocy;&tcy;&dcy;&iecy;&lcy;&softcy;&ncy;&ycy;&iecy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ycy; &icy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &bcy;&ocy;&lcy;&softcy;&shcy;&iecy; &ncy;&iecy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy; &rcy;&iecy;&zhcy;&icy;&mcy; &icy;&scy;&pcy;&rcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&jcy;  <code>git add</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &vcy;&ycy;&bcy;&rcy;&acy;&tcy;&softcy; &vcy;&scy;&iecy; &ocy;&scy;&tcy;&acy;&vcy;&shcy;&icy;&iecy;&scy;&yacy; &ncy;&iecy;&zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;.</span></p> </li> <li> <p><span data-i18n="2f9d8e43468d9b74205effb50ca8e8274454e264351e9aaefff3cc5e8845a8d3/39" data-source="Once again, check to verify that you&amp;rsquo;ve included what you want to. You may also wish to verify that git diff doesn&amp;rsquo;t show any remaining changes to be committed later." onmousemove="i18n(this)">&IEcy;&shchcy;&iecy; &rcy;&acy;&zcy; &pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&softcy;&tcy;&iecy;, &vcy;&kcy;&lcy;&yucy;&chcy;&icy;&lcy;&icy; &lcy;&icy; &vcy;&ycy; &tcy;&ocy;, &chcy;&tcy;&ocy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy;. &Vcy;&ycy; &tcy;&acy;&kcy;&zhcy;&iecy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &ucy;&bcy;&iecy;&dcy;&icy;&tcy;&softcy;&scy;&yacy;, &chcy;&tcy;&ocy; &vcy; &fcy;&acy;&jcy;&lcy;&iecy; diff  git  &ncy;&iecy;&tcy; &ocy;&scy;&tcy;&acy;&vcy;&shcy;&icy;&khcy;&scy;&yacy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&jcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &ncy;&iecy;&ocy;&bcy;&khcy;&ocy;&dcy;&icy;&mcy;&ocy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&tcy;&softcy; &pcy;&ocy;&zcy;&zhcy;&iecy;.</span></p> </li> <li> <p><span data-i18n="d50b1bb115e25db974ac0ac5875258272ac8888010d36f1ca0d75eac165a7e28/8a" data-source="And finally create the final commit." onmousemove="i18n(this)">&Icy;, &ncy;&acy;&kcy;&ocy;&ncy;&iecy;&tscy;, &scy;&ocy;&zcy;&dcy;&acy;&jcy;&tcy;&iecy; &fcy;&icy;&ncy;&acy;&lcy;&softcy;&ncy;&ycy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;.</span></p> </li> </ol> </div> </dd> </dl> </div> </div> <h2 class="text-body-emphasis"  id="_discussion"><span data-i18n="5eb6cf647d2c5d14a044e2d103dcef4cf0cdc872434c374debc1043092bc4746/dd" data-source="Discussion" onmousemove="i18n(this)">Discussion</span></h2> <div> <p><span data-i18n="76cde280f450f9879e68d078ff42056ec03c09ce67a4989c90a119fb53d32c91/1c" data-source="The tables below show what happens when running:" onmousemove="i18n(this)">&Vcy; &tcy;&acy;&bcy;&lcy;&icy;&tscy;&acy;&khcy; &ncy;&icy;&zhcy;&iecy; &pcy;&ocy;&kcy;&acy;&zcy;&acy;&ncy;&ocy;, &chcy;&tcy;&ocy; &pcy;&rcy;&ocy;&icy;&scy;&khcy;&ocy;&dcy;&icy;&tcy; &vcy;&ocy; &vcy;&rcy;&iecy;&mcy;&yacy; &rcy;&acy;&bcy;&ocy;&tcy;&ycy;:</span></p> <div> <div> <pre class="hljs language-css">git reset <span class="hljs-attr">--option</span> target</pre> </div> </div> <p><span data-i18n="f16eaf4ee0e6fd0070a1b9e8976f66179de5f280832fcf6ea990a01d972ebd85/2d" data-source="to reset the &lt;code&gt;HEAD&lt;/code&gt; to another commit (&lt;code&gt;target&lt;/code&gt;) with the different reset options depending on the state of the files." onmousemove="i18n(this)">&chcy;&tcy;&ocy;&bcy;&ycy; &scy;&bcy;&rcy;&ocy;&scy;&icy;&tcy;&softcy;  <code>HEAD</code>  &ncy;&acy; &dcy;&rcy;&ucy;&gcy;&ucy;&yucy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy; (  <code>target</code>  ) &scy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&ncy;&ycy;&mcy;&icy; &pcy;&acy;&rcy;&acy;&mcy;&iecy;&tcy;&rcy;&acy;&mcy;&icy; &scy;&bcy;&rcy;&ocy;&scy;&acy; &vcy; &zcy;&acy;&vcy;&icy;&scy;&icy;&mcy;&ocy;&scy;&tcy;&icy; &ocy;&tcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&yacy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy;.</span></p> <p><span data-i18n="be3154a2a1b721be993a94657fd8f596aef21a1112b8a409bb4ef76b743a9909/b9" data-source="In these tables, &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt;, &lt;code&gt;C&lt;/code&gt; and &lt;code&gt;D&lt;/code&gt; are some different states of a file. For example, the first line of the first table means that if a file is in state &lt;code&gt;A&lt;/code&gt; in the working tree, in state &lt;code&gt;B&lt;/code&gt; in the index, in state &lt;code&gt;C&lt;/code&gt; in &lt;code&gt;HEAD&lt;/code&gt; and in state &lt;code&gt;D&lt;/code&gt; in the target, then &lt;code&gt;git reset --soft
target&lt;/code&gt; will leave the file in the working tree in state &lt;code&gt;A&lt;/code&gt; and in the index in state &lt;code&gt;B&lt;/code&gt;. It resets (i.e. moves) the &lt;code&gt;HEAD&lt;/code&gt; (i.e. the tip of the current branch, if you are on one) to &lt;code&gt;target&lt;/code&gt; (which has the file in state &lt;code&gt;D&lt;/code&gt;)." onmousemove="i18n(this)">&Vcy; &ecy;&tcy;&icy;&khcy; &tcy;&acy;&bcy;&lcy;&icy;&tscy;&acy;&khcy;  <code>A</code> ,  <code>B</code> ,  <code>C</code>  &icy;  <code>D</code>  &mdash; &ecy;&tcy;&ocy; &ncy;&iecy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ocy; &rcy;&acy;&zcy;&ncy;&ycy;&khcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&jcy; &fcy;&acy;&jcy;&lcy;&acy;. &Ncy;&acy;&pcy;&rcy;&icy;&mcy;&iecy;&rcy;, &pcy;&iecy;&rcy;&vcy;&acy;&yacy; &scy;&tcy;&rcy;&ocy;&kcy;&acy; &pcy;&iecy;&rcy;&vcy;&ocy;&jcy; &tcy;&acy;&bcy;&lcy;&icy;&tscy;&ycy; &ocy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy; &iecy;&scy;&lcy;&icy; &fcy;&acy;&jcy;&lcy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&tcy;&scy;&yacy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>A</code>  &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>B</code>  &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&iecy;, &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>C</code>  &vcy;  <code>HEAD</code>  &icy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>D</code>  &vcy; &tscy;&iecy;&lcy;&iecy;&vcy;&ocy;&mcy;, &tcy;&ocy;  <code>git reset --soft
target</code>  &pcy;&ocy;&kcy;&icy;&ncy;&iecy;&tcy; &fcy;&acy;&jcy;&lcy;. &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>A</code>  &icy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&iecy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>B</code> . &Ocy;&ncy; &scy;&bcy;&rcy;&acy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; (&tcy;.&iecy;. &pcy;&iecy;&rcy;&iecy;&mcy;&iecy;&shchcy;&acy;&iecy;&tcy;)  <code>HEAD</code>  (&tcy;.&iecy;. &kcy;&ocy;&ncy;&chcy;&icy;&kcy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy; &vcy;&iecy;&tcy;&kcy;&icy;, &iecy;&scy;&lcy;&icy; &vcy;&ycy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&tcy;&iecy;&scy;&softcy; &ncy;&acy; &ncy;&iecy;&jcy;) &vcy;  <code>target</code>  (&fcy;&acy;&jcy;&lcy; &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&gcy;&ocy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&tcy;&scy;&yacy; &vcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&icy;  <code>D</code> ).</span></p> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 <span class="hljs-selector-tag">A</span>       <span class="hljs-selector-tag">B</span>     C    D     <span class="hljs-attr">--soft</span>   <span class="hljs-selector-tag">A</span>       <span class="hljs-selector-tag">B</span>     D
                          <span class="hljs-attr">--mixed</span>  <span class="hljs-selector-tag">A</span>       D     D
                          <span class="hljs-attr">--hard</span>   D       D     D
                          <span class="hljs-attr">--merge</span> (disallowed)
                          <span class="hljs-attr">--keep</span>  (disallowed)</pre> </div> </div> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 <span class="hljs-selector-tag">A</span>       <span class="hljs-selector-tag">B</span>     C    C     <span class="hljs-attr">--soft</span>   <span class="hljs-selector-tag">A</span>       <span class="hljs-selector-tag">B</span>     C
                          <span class="hljs-attr">--mixed</span>  <span class="hljs-selector-tag">A</span>       C     C
                          <span class="hljs-attr">--hard</span>   C       C     C
                          <span class="hljs-attr">--merge</span> (disallowed)
                          <span class="hljs-attr">--keep</span>   <span class="hljs-selector-tag">A</span>       C     C</pre> </div> </div> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 <span class="hljs-selector-tag">B</span>       <span class="hljs-selector-tag">B</span>     C    D     <span class="hljs-attr">--soft</span>   <span class="hljs-selector-tag">B</span>       <span class="hljs-selector-tag">B</span>     D
                          <span class="hljs-attr">--mixed</span>  <span class="hljs-selector-tag">B</span>       D     D
                          <span class="hljs-attr">--hard</span>   D       D     D
                          <span class="hljs-attr">--merge</span>  D       D     D
                          <span class="hljs-attr">--keep</span>  (disallowed)</pre> </div> </div> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 <span class="hljs-selector-tag">B</span>       <span class="hljs-selector-tag">B</span>     C    C     <span class="hljs-attr">--soft</span>   <span class="hljs-selector-tag">B</span>       <span class="hljs-selector-tag">B</span>     C
                          <span class="hljs-attr">--mixed</span>  <span class="hljs-selector-tag">B</span>       C     C
                          <span class="hljs-attr">--hard</span>   C       C     C
                          <span class="hljs-attr">--merge</span>  C       C     C
                          <span class="hljs-attr">--keep</span>   <span class="hljs-selector-tag">B</span>       C     C</pre> </div> </div> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 <span class="hljs-selector-tag">B</span>       C     C    D     <span class="hljs-attr">--soft</span>   <span class="hljs-selector-tag">B</span>       C     D
                          <span class="hljs-attr">--mixed</span>  <span class="hljs-selector-tag">B</span>       D     D
                          <span class="hljs-attr">--hard</span>   D       D     D
                          <span class="hljs-attr">--merge</span> (disallowed)
                          <span class="hljs-attr">--keep</span>  (disallowed)</pre> </div> </div> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 <span class="hljs-selector-tag">B</span>       C     C    C     <span class="hljs-attr">--soft</span>   <span class="hljs-selector-tag">B</span>       C     C
                          <span class="hljs-attr">--mixed</span>  <span class="hljs-selector-tag">B</span>       C     C
                          <span class="hljs-attr">--hard</span>   C       C     C
                          <span class="hljs-attr">--merge</span>  <span class="hljs-selector-tag">B</span>       C     C
                          <span class="hljs-attr">--keep</span>   <span class="hljs-selector-tag">B</span>       C     C</pre> </div> </div> <p><span data-i18n="fbf558e6ceaaa21120da5a543b45dc862e18aeba5aa65d23185987bd144bb461/5f" data-source="&lt;code&gt;reset --merge&lt;/code&gt; is meant to be used when resetting out of a conflicted merge. Any mergy operation guarantees that the working tree file that is involved in the merge does not have a local change with respect to the index before it starts, and that it writes the result out to the working tree. So if we see some difference between the index and the target and also between the index and the working tree, then it means that we are not resetting out from a state that a mergy operation left after failing with a conflict. That is why we disallow &lt;code&gt;--merge&lt;/code&gt; option in this case." onmousemove="i18n(this)"><code>reset --merge</code>  &pcy;&rcy;&iecy;&dcy;&ncy;&acy;&zcy;&ncy;&acy;&chcy;&iecy;&ncy; &dcy;&lcy;&yacy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&ncy;&icy;&yacy; &pcy;&rcy;&icy; &scy;&bcy;&rcy;&ocy;&scy;&iecy; &pcy;&ocy;&scy;&lcy;&iecy; &kcy;&ocy;&ncy;&fcy;&lcy;&icy;&kcy;&tcy;&ncy;&ocy;&gcy;&ocy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy;. &Lcy;&yucy;&bcy;&acy;&yacy; &ocy;&pcy;&iecy;&rcy;&acy;&tscy;&icy;&yacy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy; &gcy;&acy;&rcy;&acy;&ncy;&tcy;&icy;&rcy;&ucy;&iecy;&tcy;, &chcy;&tcy;&ocy; &fcy;&acy;&jcy;&lcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&gcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &ucy;&chcy;&acy;&scy;&tcy;&vcy;&ucy;&iecy;&tcy; &vcy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&icy;, &ncy;&iecy; &icy;&mcy;&iecy;&iecy;&tcy; &lcy;&ocy;&kcy;&acy;&lcy;&softcy;&ncy;&ycy;&khcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&jcy; &pcy;&ocy; &ocy;&tcy;&ncy;&ocy;&shcy;&iecy;&ncy;&icy;&yucy; &kcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ucy; &dcy;&ocy; &iecy;&gcy;&ocy; &zcy;&acy;&pcy;&ucy;&scy;&kcy;&acy;, &icy; &chcy;&tcy;&ocy; &ocy;&ncy; &zcy;&acy;&pcy;&icy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &rcy;&iecy;&zcy;&ucy;&lcy;&softcy;&tcy;&acy;&tcy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;. &Pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy;, &iecy;&scy;&lcy;&icy; &mcy;&ycy; &vcy;&icy;&dcy;&icy;&mcy; &ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ucy;&yucy; &rcy;&acy;&zcy;&ncy;&icy;&tscy;&ucy; &mcy;&iecy;&zhcy;&dcy;&ucy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ocy;&mcy; &icy; &tscy;&iecy;&lcy;&softcy;&yucy;, &acy; &tcy;&acy;&kcy;&zhcy;&iecy; &mcy;&iecy;&zhcy;&dcy;&ucy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ocy;&mcy; &icy; &rcy;&acy;&bcy;&ocy;&chcy;&icy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;&mcy;, &tcy;&ocy; &ecy;&tcy;&ocy; &ocy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy; &mcy;&ycy; &ncy;&iecy; &vcy;&ycy;&khcy;&ocy;&dcy;&icy;&mcy; &icy;&zcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&yacy;, &vcy; &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&mcy; &ocy;&pcy;&iecy;&rcy;&acy;&tscy;&icy;&yacy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy; &ocy;&scy;&tcy;&acy;&lcy;&acy;&scy;&softcy; &pcy;&ocy;&scy;&lcy;&iecy; &ncy;&iecy;&ucy;&dcy;&acy;&chcy;&icy; &scy; &kcy;&ocy;&ncy;&fcy;&lcy;&icy;&kcy;&tcy;&ocy;&mcy;. &Vcy;&ocy;&tcy; &pcy;&ocy;&chcy;&iecy;&mcy;&ucy; &vcy; &ecy;&tcy;&ocy;&mcy; &scy;&lcy;&ucy;&chcy;&acy;&iecy; &mcy;&ycy; &zcy;&acy;&pcy;&rcy;&iecy;&shchcy;&acy;&iecy;&mcy; &ocy;&pcy;&tscy;&icy;&yucy;  <code>--merge</code> .</span></p> <p><span data-i18n="225b3e67e8246ac75b5e5b8ff5aeb80443ff8472c9da935a5b69deb65e4e2d63/d6" data-source="&lt;code&gt;reset --keep&lt;/code&gt; is meant to be used when removing some of the last commits in the current branch while keeping changes in the working tree. If there could be conflicts between the changes in the commit we want to remove and the changes in the working tree we want to keep, the reset is disallowed. That&amp;rsquo;s why it is disallowed if there are both changes between the working tree and &lt;code&gt;HEAD&lt;/code&gt;, and between &lt;code&gt;HEAD&lt;/code&gt; and the target. To be safe, it is also disallowed when there are unmerged entries." onmousemove="i18n(this)"><code>reset --keep</code>  &pcy;&rcy;&iecy;&dcy;&ncy;&acy;&zcy;&ncy;&acy;&chcy;&iecy;&ncy; &dcy;&lcy;&yacy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&ncy;&icy;&yacy; &pcy;&rcy;&icy; &ucy;&dcy;&acy;&lcy;&iecy;&ncy;&icy;&icy; &ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&khcy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&icy;&khcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy; &vcy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy; &vcy;&iecy;&tcy;&kcy;&iecy; &scy; &scy;&ocy;&khcy;&rcy;&acy;&ncy;&iecy;&ncy;&icy;&iecy;&mcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&jcy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;. &IEcy;&scy;&lcy;&icy; &mcy;&ocy;&gcy;&ucy;&tcy; &vcy;&ocy;&zcy;&ncy;&icy;&kcy;&ncy;&ucy;&tcy;&softcy; &kcy;&ocy;&ncy;&fcy;&lcy;&icy;&kcy;&tcy;&ycy; &mcy;&iecy;&zhcy;&dcy;&ucy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;&mcy;&icy; &vcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &mcy;&ycy; &khcy;&ocy;&tcy;&icy;&mcy; &ucy;&dcy;&acy;&lcy;&icy;&tcy;&softcy;, &icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;&mcy;&icy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &mcy;&ycy; &khcy;&ocy;&tcy;&icy;&mcy; &scy;&ocy;&khcy;&rcy;&acy;&ncy;&icy;&tcy;&softcy;, &scy;&bcy;&rcy;&ocy;&scy; &ncy;&iecy; &dcy;&ocy;&pcy;&ucy;&scy;&kcy;&acy;&iecy;&tcy;&scy;&yacy;. &Vcy;&ocy;&tcy; &pcy;&ocy;&chcy;&iecy;&mcy;&ucy; &ecy;&tcy;&ocy; &zcy;&acy;&pcy;&rcy;&iecy;&shchcy;&iecy;&ncy;&ocy;, &iecy;&scy;&lcy;&icy; &iecy;&scy;&tcy;&softcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &kcy;&acy;&kcy; &mcy;&iecy;&zhcy;&dcy;&ucy; &rcy;&acy;&bcy;&ocy;&chcy;&icy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;&mcy; &icy;  <code>HEAD</code> , &tcy;&acy;&kcy; &icy; &mcy;&iecy;&zhcy;&dcy;&ucy;  <code>HEAD</code>  &icy; &tscy;&iecy;&lcy;&softcy;&yucy;. &Vcy; &tscy;&iecy;&lcy;&yacy;&khcy; &bcy;&iecy;&zcy;&ocy;&pcy;&acy;&scy;&ncy;&ocy;&scy;&tcy;&icy; &ecy;&tcy;&ocy; &tcy;&acy;&kcy;&zhcy;&iecy; &zcy;&acy;&pcy;&rcy;&iecy;&shchcy;&iecy;&ncy;&ocy; &pcy;&rcy;&icy; &ncy;&acy;&lcy;&icy;&chcy;&icy;&icy; &ncy;&iecy;&scy;&vcy;&yacy;&zcy;&acy;&ncy;&ncy;&ycy;&khcy; &zcy;&acy;&pcy;&icy;&scy;&iecy;&jcy;.</span></p> <p><span data-i18n="0b432ccff6c033dc1db55665a92d5493d995759fdd8c6280e459fdc3dcd93ae8/4e" data-source="The following tables show what happens when there are unmerged entries:" onmousemove="i18n(this)">&Vcy; &scy;&lcy;&iecy;&dcy;&ucy;&yucy;&shchcy;&icy;&khcy; &tcy;&acy;&bcy;&lcy;&icy;&tscy;&acy;&khcy; &pcy;&ocy;&kcy;&acy;&zcy;&acy;&ncy;&ocy;, &chcy;&tcy;&ocy; &pcy;&rcy;&ocy;&icy;&scy;&khcy;&ocy;&dcy;&icy;&tcy; &pcy;&rcy;&icy; &ncy;&acy;&lcy;&icy;&chcy;&icy;&icy; &ncy;&iecy;&scy;&vcy;&yacy;&zcy;&acy;&ncy;&ncy;&ycy;&khcy; &zcy;&acy;&pcy;&icy;&scy;&iecy;&jcy;:</span></p> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 X       U     <span class="hljs-selector-tag">A</span>    <span class="hljs-selector-tag">B</span>     <span class="hljs-attr">--soft</span>  (disallowed)
                          <span class="hljs-attr">--mixed</span>  X       <span class="hljs-selector-tag">B</span>     <span class="hljs-selector-tag">B</span>
                          <span class="hljs-attr">--hard</span>   <span class="hljs-selector-tag">B</span>       <span class="hljs-selector-tag">B</span>     <span class="hljs-selector-tag">B</span>
                          <span class="hljs-attr">--merge</span>  <span class="hljs-selector-tag">B</span>       <span class="hljs-selector-tag">B</span>     <span class="hljs-selector-tag">B</span>
                          <span class="hljs-attr">--keep</span>  (disallowed)</pre> </div> </div> <div> <div> <pre class="hljs language-css">working index HEAD target         working index HEAD
----------------------------------------------------
 X       U     <span class="hljs-selector-tag">A</span>    <span class="hljs-selector-tag">A</span>     <span class="hljs-attr">--soft</span>  (disallowed)
                          <span class="hljs-attr">--mixed</span>  X       <span class="hljs-selector-tag">A</span>     <span class="hljs-selector-tag">A</span>
                          <span class="hljs-attr">--hard</span>   <span class="hljs-selector-tag">A</span>       <span class="hljs-selector-tag">A</span>     <span class="hljs-selector-tag">A</span>
                          <span class="hljs-attr">--merge</span>  <span class="hljs-selector-tag">A</span>       <span class="hljs-selector-tag">A</span>     <span class="hljs-selector-tag">A</span>
                          <span class="hljs-attr">--keep</span>  (disallowed)</pre> </div> </div> <p><span data-i18n="915489199551a12e7e7b0b02b0d98d303317c3b742113852f1ed67b58af73eca/68" data-source="&lt;code&gt;X&lt;/code&gt; means any state and &lt;code&gt;U&lt;/code&gt; means an unmerged index." onmousemove="i18n(this)"><code>X</code>  &ocy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy; &lcy;&yucy;&bcy;&ocy;&iecy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy;, &acy;  <code>U</code>  &ocy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy; &ncy;&iecy;&scy;&vcy;&yacy;&zcy;&acy;&ncy;&ncy;&ycy;&jcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;.</span></p> </div><address>
<p>
    &copy; 2012&ndash;2024 Scott Chacon and others<br/>Licensed under the MIT License.<br/>
<a href="https://git-scm.com/docs/git-reset">https://git-scm.com/docs/git-reset</a>
</p>
</address>                </article>
            </main>

            <br>
            <br>
            <hr>

                            <ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-6424571640879890"
     data-ad-slot="3954319254"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>            
        </div>

        <!-- -->

        <div class="col-md-3">
            <br>
            <form action="-index-.html">
                <div class="input-group">
                    <input class="form-control" type="search" name="q" placeholder="Search for Git" required>
                    <button class="btn btn-primary" type="submit">
                        <i class="bi bi-search"></i>
                    </button>
                </div>
            </form>
            <br>

                            <div class="list-group list-group-flush">
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-restore.html">
                            git restore                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-rev-list.html">
                            git rev-list                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-rev-parse.html">
                            git rev-parse                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-revert.html">
                            git revert                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-rm.html">
                            git rm                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-send-email.html">
                            git send-email                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="git-send-pack.html">
                            git send-pack                        </a>
                                    </div>
            
            <br>
            <div class="my-3">
                   <ins class="adsbygoogle"
        style="display:block"
        data-ad-format="autorelaxed"
        data-ad-client="ca-pub-6424571640879890"
        data-ad-slot="7867651344"></ins>
   <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
   </script>            </div>
            <br>

            
            
        </div>
    </div>
</div>    <!--/sse-->

    <footer>
        <br>
        <div class="container">
            <div class="row">
                <div class="col">
                    <hr>
                    <div class="row">
                        <div class="col-md-10">
                            <ul class="nav">
                                <li class="nav-item">
                                    <a class="nav-link ps-0" href="https://runebook.dev/">Help us Improve Translation</a>
                                </li>
                                                            </ul>
                        </div>
                        <div class="col-md-2 text-end">
                            <a href="git-reset.html#" class="fs-5" aria-label="Top">
                                <i class="bi bi-arrow-up-square-fill"></i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <br>
    </footer>
    <script src="../../../runebook.js"></script>
</body>

</html>